Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: content/browser/web_contents/web_contents_impl.h

Issue 803873004: ContentBrowserSanityChecker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jiggle the comments. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 class CONTENT_EXPORT WebContentsImpl 92 class CONTENT_EXPORT WebContentsImpl
93 : public NON_EXPORTED_BASE(WebContents), 93 : public NON_EXPORTED_BASE(WebContents),
94 public NON_EXPORTED_BASE(RenderFrameHostDelegate), 94 public NON_EXPORTED_BASE(RenderFrameHostDelegate),
95 public RenderViewHostDelegate, 95 public RenderViewHostDelegate,
96 public RenderWidgetHostDelegate, 96 public RenderWidgetHostDelegate,
97 public RenderFrameHostManager::Delegate, 97 public RenderFrameHostManager::Delegate,
98 public NotificationObserver, 98 public NotificationObserver,
99 public NON_EXPORTED_BASE(NavigationControllerDelegate), 99 public NON_EXPORTED_BASE(NavigationControllerDelegate),
100 public NON_EXPORTED_BASE(NavigatorDelegate) { 100 public NON_EXPORTED_BASE(NavigatorDelegate) {
101 public: 101 public:
102 class FriendZone;
103
102 ~WebContentsImpl() override; 104 ~WebContentsImpl() override;
103 105
104 static WebContentsImpl* CreateWithOpener( 106 static WebContentsImpl* CreateWithOpener(
105 const WebContents::CreateParams& params, 107 const WebContents::CreateParams& params,
106 WebContentsImpl* opener); 108 WebContentsImpl* opener);
107 109
108 static std::vector<WebContentsImpl*> GetAllWebContents(); 110 static std::vector<WebContentsImpl*> GetAllWebContents();
109 111
110 // Returns the opener WebContentsImpl, if any. This can be set to null if the 112 // Returns the opener WebContentsImpl, if any. This can be set to null if the
111 // opener is closed or the page clears its window.opener. 113 // opener is closed or the page clears its window.opener.
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 660
659 bool has_audio_power_save_blocker_for_testing() const { 661 bool has_audio_power_save_blocker_for_testing() const {
660 return audio_power_save_blocker_; 662 return audio_power_save_blocker_;
661 } 663 }
662 664
663 bool has_video_power_save_blocker_for_testing() const { 665 bool has_video_power_save_blocker_for_testing() const {
664 return video_power_save_blocker_; 666 return video_power_save_blocker_;
665 } 667 }
666 668
667 private: 669 private:
668 friend class TestNavigationObserver;
669 friend class WebContentsAddedObserver;
670 friend class WebContentsObserver; 670 friend class WebContentsObserver;
671 friend class WebContents; // To implement factory methods. 671 friend class WebContents; // To implement factory methods.
672 672
673 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); 673 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
674 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); 674 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
675 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); 675 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending);
676 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, 676 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
677 CrossSiteCantPreemptAfterUnload); 677 CrossSiteCantPreemptAfterUnload);
678 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); 678 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents);
679 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); 679 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 typedef std::vector<int64> PlayerList; 937 typedef std::vector<int64> PlayerList;
938 typedef std::map<uintptr_t, PlayerList> ActiveMediaPlayerMap; 938 typedef std::map<uintptr_t, PlayerList> ActiveMediaPlayerMap;
939 void AddMediaPlayerEntry(int64 player_cookie, 939 void AddMediaPlayerEntry(int64 player_cookie,
940 ActiveMediaPlayerMap* player_map); 940 ActiveMediaPlayerMap* player_map);
941 void RemoveMediaPlayerEntry(int64 player_cookie, 941 void RemoveMediaPlayerEntry(int64 player_cookie,
942 ActiveMediaPlayerMap* player_map); 942 ActiveMediaPlayerMap* player_map);
943 // Removes all entries from |player_map| for |render_frame_host|. 943 // Removes all entries from |player_map| for |render_frame_host|.
944 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host, 944 void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host,
945 ActiveMediaPlayerMap* player_map); 945 ActiveMediaPlayerMap* player_map);
946 946
947 // Adds/removes a callback called on creation of each new WebContents.
948 // Deprecated, about to remove.
949 static void AddCreatedCallback(const CreatedCallback& callback);
950 static void RemoveCreatedCallback(const CreatedCallback& callback);
951
952 // Data for core operation --------------------------------------------------- 947 // Data for core operation ---------------------------------------------------
953 948
954 // Delegate for notifying our owner about stuff. Not owned by us. 949 // Delegate for notifying our owner about stuff. Not owned by us.
955 WebContentsDelegate* delegate_; 950 WebContentsDelegate* delegate_;
956 951
957 // Handles the back/forward list and loading. 952 // Handles the back/forward list and loading.
958 NavigationControllerImpl controller_; 953 NavigationControllerImpl controller_;
959 954
960 // The corresponding view. 955 // The corresponding view.
961 scoped_ptr<WebContentsView> view_; 956 scoped_ptr<WebContentsView> view_;
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 // Created on-demand to mute all audio output from this WebContents. 1224 // Created on-demand to mute all audio output from this WebContents.
1230 scoped_ptr<WebContentsAudioMuter> audio_muter_; 1225 scoped_ptr<WebContentsAudioMuter> audio_muter_;
1231 1226
1232 bool virtual_keyboard_requested_; 1227 bool virtual_keyboard_requested_;
1233 1228
1234 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_; 1229 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
1235 1230
1236 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1231 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1237 }; 1232 };
1238 1233
1234 // Dangerous methods which should never be made part of the public API, so we
1235 // grant their use only to an explicit friend list (c++ attorney/client idiom).
1236 class CONTENT_EXPORT WebContentsImpl::FriendZone {
1237 private:
1238 friend class TestNavigationObserver;
1239 friend class WebContentsAddedObserver;
1240 friend class ContentBrowserSanityChecker;
1241
1242 FriendZone(); // Not instantiable.
1243
1244 // Adds/removes a callback called on creation of each new WebContents.
1245 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1246 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1247
1248 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1249 };
1250
1239 } // namespace content 1251 } // namespace content
1240 1252
1241 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1253 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698