From 001275339b4a26004b85e76d1bb10b5c693d45d9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 8 Mar 2018 16:45:37 +0900 Subject: [PATCH] Hide WebContentPreferences::GetWebContentsFromProcessID from public --- atom/browser/atom_permission_manager.cc | 10 ++++++---- atom/browser/web_contents_preferences.h | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/atom/browser/atom_permission_manager.cc b/atom/browser/atom_permission_manager.cc index 88b31debee9d..e3e9c94ce96e 100644 --- a/atom/browser/atom_permission_manager.cc +++ b/atom/browser/atom_permission_manager.cc @@ -6,6 +6,7 @@ #include +#include "atom/browser/atom_browser_client.h" #include "atom/browser/web_contents_preferences.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/permission_type.h" @@ -19,11 +20,12 @@ namespace atom { namespace { bool WebContentsDestroyed(int process_id) { - auto contents = - WebContentsPreferences::GetWebContentsFromProcessID(process_id); - if (!contents) + content::WebContents* web_contents = + static_cast(AtomBrowserClient::Get())-> + GetWebContentsFromProcessID(process_id); + if (!web_contents) return true; - return contents->IsBeingDestroyed(); + return web_contents->IsBeingDestroyed(); } void PermissionRequestResponseCallbackWrapper( diff --git a/atom/browser/web_contents_preferences.h b/atom/browser/web_contents_preferences.h index ab2837d983d4..1ab2c7ab3e19 100644 --- a/atom/browser/web_contents_preferences.h +++ b/atom/browser/web_contents_preferences.h @@ -29,10 +29,6 @@ namespace atom { class WebContentsPreferences : public content::WebContentsUserData { public: - // Get WebContents according to process ID. - // FIXME(zcbenz): This method does not belong here. - static content::WebContents* GetWebContentsFromProcessID(int process_id); - // Get self from WebContents. static WebContentsPreferences* From(content::WebContents* web_contents); // Get self from procese ID. @@ -63,6 +59,10 @@ class WebContentsPreferences private: friend class content::WebContentsUserData; + friend class AtomBrowserClient; + + // Get WebContents according to process ID. + static content::WebContents* GetWebContentsFromProcessID(int process_id); // Set preference value to given bool if user did not provide value bool SetDefaultBoolIfUndefined(const base::StringPiece& key, bool val);