Correctly set initial visibilityState
This commit is contained in:
parent
07a4c52919
commit
43c44da50b
8 changed files with 37 additions and 17 deletions
|
@ -1127,6 +1127,12 @@ bool WebContents::IsGuest() const {
|
|||
return type_ == WEB_VIEW;
|
||||
}
|
||||
|
||||
void WebContents::MergeWebPreferences(const base::DictionaryValue& extend) {
|
||||
WebContentsPreferences* web_preferences =
|
||||
WebContentsPreferences::FromWebContents(web_contents());
|
||||
web_preferences->Merge(extend);
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
|
||||
WebContentsPreferences* web_preferences =
|
||||
WebContentsPreferences::FromWebContents(web_contents());
|
||||
|
@ -1221,6 +1227,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("endFrameSubscription", &WebContents::EndFrameSubscription)
|
||||
.SetMethod("setSize", &WebContents::SetSize)
|
||||
.SetMethod("isGuest", &WebContents::IsGuest)
|
||||
.SetMethod("mergeWebPreferences", &WebContents::MergeWebPreferences)
|
||||
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
|
||||
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
|
||||
.SetMethod("hasServiceWorker", &WebContents::HasServiceWorker)
|
||||
|
|
|
@ -144,6 +144,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
WindowOpenDisposition disposition);
|
||||
|
||||
// Returns the web preferences of current WebContents.
|
||||
void MergeWebPreferences(const base::DictionaryValue& extend);
|
||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
||||
|
||||
// Returns the owner window.
|
||||
|
|
|
@ -131,20 +131,25 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches(
|
|||
// --guest-instance-id, which is used to identify guest WebContents.
|
||||
int guest_instance_id;
|
||||
if (web_preferences.GetInteger(options::kGuestInstanceID, &guest_instance_id))
|
||||
command_line->AppendSwitchASCII(switches::kGuestInstanceID,
|
||||
base::IntToString(guest_instance_id));
|
||||
command_line->AppendSwitchASCII(switches::kGuestInstanceID,
|
||||
base::IntToString(guest_instance_id));
|
||||
|
||||
// Pass the opener's window id.
|
||||
int opener_id;
|
||||
if (web_preferences.GetInteger(options::kOpenerID, &opener_id))
|
||||
command_line->AppendSwitchASCII(switches::kOpenerID,
|
||||
base::IntToString(opener_id));
|
||||
command_line->AppendSwitchASCII(switches::kOpenerID,
|
||||
base::IntToString(opener_id));
|
||||
|
||||
// Enable blink features.
|
||||
std::string blink_features;
|
||||
if (web_preferences.GetString(options::kBlinkFeatures, &blink_features))
|
||||
command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures,
|
||||
blink_features);
|
||||
command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures,
|
||||
blink_features);
|
||||
|
||||
// The initial visibility state.
|
||||
std::string visibility;
|
||||
if (web_preferences.GetString(options::kVisibilityState, &visibility))
|
||||
command_line->AppendSwitchASCII(switches::kVisibilityState, visibility);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue