child_web_contents_tracker.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) 2017 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_BROWSER_CHILD_WEB_CONTENTS_TRACKER_H_
  5. #define ELECTRON_SHELL_BROWSER_CHILD_WEB_CONTENTS_TRACKER_H_
  6. #include <string>
  7. #include "content/public/browser/web_contents_user_data.h"
  8. namespace electron {
  9. // ChildWebContentsTracker tracks child WebContents
  10. // created by native `window.open()`
  11. struct ChildWebContentsTracker
  12. : public content::WebContentsUserData<ChildWebContentsTracker> {
  13. ~ChildWebContentsTracker() override;
  14. // disable copy
  15. ChildWebContentsTracker(const ChildWebContentsTracker&) = delete;
  16. ChildWebContentsTracker& operator=(const ChildWebContentsTracker&) = delete;
  17. GURL url;
  18. std::string frame_name;
  19. content::Referrer referrer;
  20. std::string raw_features;
  21. scoped_refptr<network::ResourceRequestBody> body;
  22. private:
  23. explicit ChildWebContentsTracker(content::WebContents* web_contents);
  24. friend class content::WebContentsUserData<ChildWebContentsTracker>;
  25. WEB_CONTENTS_USER_DATA_KEY_DECL();
  26. };
  27. } // namespace electron
  28. #endif // ELECTRON_SHELL_BROWSER_CHILD_WEB_CONTENTS_TRACKER_H_