Hide WebContentPreferences::GetWebContentsFromProcessID from public

This commit is contained in:
Cheng Zhao 2018-03-08 16:45:37 +09:00
parent 3d47a8a2fd
commit 001275339b
2 changed files with 10 additions and 8 deletions

View file

@ -6,6 +6,7 @@
#include <vector>
#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*>(AtomBrowserClient::Get())->
GetWebContentsFromProcessID(process_id);
if (!web_contents)
return true;
return contents->IsBeingDestroyed();
return web_contents->IsBeingDestroyed();
}
void PermissionRequestResponseCallbackWrapper(

View file

@ -29,10 +29,6 @@ namespace atom {
class WebContentsPreferences
: public content::WebContentsUserData<WebContentsPreferences> {
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<WebContentsPreferences>;
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);