Correctly set initial visibilityState

This commit is contained in:
Cheng Zhao 2016-04-13 22:56:11 +09:00
parent 07a4c52919
commit 43c44da50b
8 changed files with 37 additions and 17 deletions

View file

@ -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)

View file

@ -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.