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
|
||||
|
|
|
@ -106,6 +106,9 @@ const char kOpenerID[] = "openerId";
|
|||
// Enable blink features.
|
||||
const char kBlinkFeatures[] = "blinkFeatures";
|
||||
|
||||
// The initiali visibility state.
|
||||
const char kVisibilityState[] = "visibilityState";
|
||||
|
||||
} // namespace options
|
||||
|
||||
namespace switches {
|
||||
|
@ -149,6 +152,7 @@ const char kPreloadURL[] = "preload-url";
|
|||
const char kNodeIntegration[] = "node-integration";
|
||||
const char kGuestInstanceID[] = "guest-instance-id";
|
||||
const char kOpenerID[] = "opener-id";
|
||||
const char kVisibilityState[] = "visibility-state";
|
||||
|
||||
// Widevine options
|
||||
// Path to Widevine CDM binaries.
|
||||
|
|
|
@ -56,6 +56,7 @@ extern const char kGuestInstanceID[];
|
|||
extern const char kExperimentalFeatures[];
|
||||
extern const char kExperimentalCanvasFeatures[];
|
||||
extern const char kOpenerID[];
|
||||
extern const char kVisibilityState[];
|
||||
extern const char kBlinkFeatures[];
|
||||
|
||||
} // namespace options
|
||||
|
@ -83,6 +84,7 @@ extern const char kPreloadURL[];
|
|||
extern const char kNodeIntegration[];
|
||||
extern const char kGuestInstanceID[];
|
||||
extern const char kOpenerID[];
|
||||
extern const char kVisibilityState[];
|
||||
|
||||
extern const char kWidevineCdmPath[];
|
||||
extern const char kWidevineCdmVersion[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue