No need to define WebContentsPreferences::From
This commit is contained in:
parent
3717f5b7f2
commit
24bbe5dabf
3 changed files with 8 additions and 17 deletions
|
@ -10,6 +10,8 @@
|
|||
#include "content/public/browser/browser_context.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
using atom::WebContentsPreferences;
|
||||
|
||||
namespace mate {
|
||||
|
||||
template<>
|
||||
|
@ -48,7 +50,7 @@ void AddGuest(int guest_instance_id,
|
|||
manager->AddGuest(guest_instance_id, element_instance_id, embedder,
|
||||
guest_web_contents);
|
||||
|
||||
atom::WebContentsPreferences::From(guest_web_contents)->Merge(options);
|
||||
WebContentsPreferences::FromWebContents(guest_web_contents)->Merge(options);
|
||||
}
|
||||
|
||||
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {
|
||||
|
|
|
@ -16,13 +16,12 @@
|
|||
#include "ui/gfx/switches.h"
|
||||
#endif
|
||||
|
||||
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPreferences);
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace {
|
||||
|
||||
// Pointer as WebContents's user data key.
|
||||
const char* kWebPreferencesKey = "WebContentsPreferences";
|
||||
|
||||
// Array of available web runtime features.
|
||||
const char* kWebRuntimeFeatures[] = {
|
||||
switches::kExperimentalFeatures,
|
||||
|
@ -40,7 +39,7 @@ WebContentsPreferences::WebContentsPreferences(
|
|||
content::WebContents* web_contents,
|
||||
base::DictionaryValue* web_preferences) {
|
||||
web_preferences_.Swap(web_preferences);
|
||||
web_contents->SetUserData(kWebPreferencesKey, this);
|
||||
web_contents->SetUserData(UserDataKey(), this);
|
||||
}
|
||||
|
||||
WebContentsPreferences::~WebContentsPreferences() {
|
||||
|
@ -50,17 +49,10 @@ void WebContentsPreferences::Merge(const base::DictionaryValue& extend) {
|
|||
web_preferences_.MergeDictionary(&extend);
|
||||
}
|
||||
|
||||
// static
|
||||
WebContentsPreferences* WebContentsPreferences::From(
|
||||
content::WebContents* web_contents) {
|
||||
return static_cast<WebContentsPreferences*>(
|
||||
web_contents->GetUserData(kWebPreferencesKey));
|
||||
}
|
||||
|
||||
// static
|
||||
void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
||||
content::WebContents* web_contents, base::CommandLine* command_line) {
|
||||
WebContentsPreferences* self = From(web_contents);
|
||||
WebContentsPreferences* self = FromWebContents(web_contents);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
|
@ -130,7 +122,7 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
|||
// static
|
||||
void WebContentsPreferences::OverrideWebkitPrefs(
|
||||
content::WebContents* web_contents, content::WebPreferences* prefs) {
|
||||
WebContentsPreferences* self = From(web_contents);
|
||||
WebContentsPreferences* self = FromWebContents(web_contents);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ namespace atom {
|
|||
class WebContentsPreferences
|
||||
: public content::WebContentsUserData<WebContentsPreferences> {
|
||||
public:
|
||||
// Get the preferences of |web_contents|.
|
||||
static WebContentsPreferences* From(content::WebContents* web_contents);
|
||||
|
||||
// Append command paramters according to |web_contents|'s preferences.
|
||||
static void AppendExtraCommandLineSwitches(
|
||||
content::WebContents* web_contents, base::CommandLine* command_line);
|
||||
|
|
Loading…
Reference in a new issue