Add WebContentsPreferences::From that checks parameter

This commit is contained in:
Cheng Zhao 2018-03-08 16:12:45 +09:00
parent 9772777919
commit 887bc12350
7 changed files with 21 additions and 15 deletions

View file

@ -115,7 +115,7 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate,
// These preferences will be used when the webContent launches new
// render processes.
auto* existing_preferences =
WebContentsPreferences::FromWebContents(web_contents->web_contents());
WebContentsPreferences::From(web_contents->web_contents());
base::DictionaryValue web_preferences_dict;
if (mate::ConvertFromV8(isolate, web_preferences.GetHandle(),
&web_preferences_dict)) {

View file

@ -1122,8 +1122,7 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
// created after loading a page.
const auto view = web_contents()->GetRenderWidgetHostView();
if (view) {
WebContentsPreferences* web_preferences =
WebContentsPreferences::FromWebContents(web_contents());
auto* web_preferences = WebContentsPreferences::From(web_contents());
std::string color_name;
if (web_preferences->dict()->GetString(options::kBackgroundColor,
&color_name)) {
@ -1840,8 +1839,7 @@ void WebContents::OnGetZoomLevel(content::RenderFrameHost* rfh,
}
v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
WebContentsPreferences* web_preferences =
WebContentsPreferences::FromWebContents(web_contents());
auto* web_preferences = WebContentsPreferences::From(web_contents());
if (!web_preferences)
return v8::Null(isolate);
return mate::ConvertToV8(isolate, *web_preferences->dict());

View file

@ -34,7 +34,7 @@ void AddGuest(int guest_instance_id,
->SetDefaultZoomFactor(zoom_factor);
}
WebContentsPreferences::FromWebContents(guest_web_contents)->Merge(options);
WebContentsPreferences::From(guest_web_contents)->Merge(options);
}
void RemoveGuest(content::WebContents* embedder, int guest_instance_id) {