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_ |