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

Unified 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: Add semicolon. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.h
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 8369487b3ee93b0d3fc63a90a3d6801f46fb0a6d..873b0e71857c2f9bf00790322c15caee4e348e82 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -99,6 +99,8 @@ class CONTENT_EXPORT WebContentsImpl
public NON_EXPORTED_BASE(NavigationControllerDelegate),
public NON_EXPORTED_BASE(NavigatorDelegate) {
public:
+ class FriendZone;
+
~WebContentsImpl() override;
static WebContentsImpl* CreateWithOpener(
@@ -665,8 +667,6 @@ class CONTENT_EXPORT WebContentsImpl
}
private:
- friend class TestNavigationObserver;
- friend class WebContentsAddedObserver;
friend class WebContentsObserver;
friend class WebContents; // To implement factory methods.
@@ -944,11 +944,6 @@ class CONTENT_EXPORT WebContentsImpl
void RemoveAllMediaPlayerEntries(RenderFrameHost* render_frame_host,
ActiveMediaPlayerMap* player_map);
- // Adds/removes a callback called on creation of each new WebContents.
- // Deprecated, about to remove.
- static void AddCreatedCallback(const CreatedCallback& callback);
- static void RemoveCreatedCallback(const CreatedCallback& callback);
-
// Data for core operation ---------------------------------------------------
// Delegate for notifying our owner about stuff. Not owned by us.
@@ -1236,6 +1231,23 @@ class CONTENT_EXPORT WebContentsImpl
DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
};
+// Dangerous methods which should never be made part of the public API, so we
+// grant their use only to an explicit friend list (c++ attorney/client idiom).
+class CONTENT_EXPORT WebContentsImpl::FriendZone {
+ private:
+ friend class TestNavigationObserver;
+ friend class WebContentsAddedObserver;
+ friend class ContentBrowserSanityChecker;
+
+ FriendZone(); // Not instantiable.
+
+ // Adds/removes a callback called on creation of each new WebContents.
+ static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
+ static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
+
+ DISALLOW_COPY_AND_ASSIGN(FriendZone);
+};
+
} // namespace content
#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager_unittest.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698