refactor: make methods const, cleanup (#13937)
This commit is contained in:
parent
9005803667
commit
271d582aac
5 changed files with 15 additions and 15 deletions
|
@ -1854,7 +1854,7 @@ void WebContents::SetZoomLevel(double level) {
|
||||||
zoom_controller_->SetZoomLevel(level);
|
zoom_controller_->SetZoomLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
double WebContents::GetZoomLevel() {
|
double WebContents::GetZoomLevel() const {
|
||||||
return zoom_controller_->GetZoomLevel();
|
return zoom_controller_->GetZoomLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1863,7 +1863,7 @@ void WebContents::SetZoomFactor(double factor) {
|
||||||
SetZoomLevel(level);
|
SetZoomLevel(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
double WebContents::GetZoomFactor() {
|
double WebContents::GetZoomFactor() const {
|
||||||
auto level = GetZoomLevel();
|
auto level = GetZoomLevel();
|
||||||
return content::ZoomLevelToZoomFactor(level);
|
return content::ZoomLevelToZoomFactor(level);
|
||||||
}
|
}
|
||||||
|
@ -1884,22 +1884,23 @@ void WebContents::OnGetZoomLevel(content::RenderFrameHost* rfh,
|
||||||
rfh->Send(reply_msg);
|
rfh->Send(reply_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::GetWebPreferences(v8::Isolate* isolate) {
|
v8::Local<v8::Value> WebContents::GetWebPreferences(
|
||||||
|
v8::Isolate* isolate) const {
|
||||||
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
||||||
if (!web_preferences)
|
if (!web_preferences)
|
||||||
return v8::Null(isolate);
|
return v8::Null(isolate);
|
||||||
return mate::ConvertToV8(isolate, *web_preferences->preference());
|
return mate::ConvertToV8(isolate, *web_preferences->preference());
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::GetLastWebPreferences(v8::Isolate* isolate) {
|
v8::Local<v8::Value> WebContents::GetLastWebPreferences(
|
||||||
WebContentsPreferences* web_preferences =
|
v8::Isolate* isolate) const {
|
||||||
WebContentsPreferences::FromWebContents(web_contents());
|
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
||||||
if (!web_preferences)
|
if (!web_preferences)
|
||||||
return v8::Null(isolate);
|
return v8::Null(isolate);
|
||||||
return mate::ConvertToV8(isolate, *web_preferences->last_preference());
|
return mate::ConvertToV8(isolate, *web_preferences->last_preference());
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() const {
|
||||||
if (owner_window())
|
if (owner_window())
|
||||||
return BrowserWindow::From(isolate(), owner_window());
|
return BrowserWindow::From(isolate(), owner_window());
|
||||||
else
|
else
|
||||||
|
|
|
@ -213,9 +213,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
|
|
||||||
// Methods for zoom handling.
|
// Methods for zoom handling.
|
||||||
void SetZoomLevel(double level);
|
void SetZoomLevel(double level);
|
||||||
double GetZoomLevel();
|
double GetZoomLevel() const;
|
||||||
void SetZoomFactor(double factor);
|
void SetZoomFactor(double factor);
|
||||||
double GetZoomFactor();
|
double GetZoomFactor() const;
|
||||||
|
|
||||||
// Callback triggered on permission response.
|
// Callback triggered on permission response.
|
||||||
void OnEnterFullscreenModeForTab(content::WebContents* source,
|
void OnEnterFullscreenModeForTab(content::WebContents* source,
|
||||||
|
@ -231,11 +231,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
const scoped_refptr<network::ResourceRequestBody>& body);
|
const scoped_refptr<network::ResourceRequestBody>& body);
|
||||||
|
|
||||||
// Returns the web preferences of current WebContents.
|
// Returns the web preferences of current WebContents.
|
||||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate) const;
|
||||||
v8::Local<v8::Value> GetLastWebPreferences(v8::Isolate* isolate);
|
v8::Local<v8::Value> GetLastWebPreferences(v8::Isolate* isolate) const;
|
||||||
|
|
||||||
// Returns the owner window.
|
// Returns the owner window.
|
||||||
v8::Local<v8::Value> GetOwnerBrowserWindow();
|
v8::Local<v8::Value> GetOwnerBrowserWindow() const;
|
||||||
|
|
||||||
// Grants the child process the capability to access URLs with the origin of
|
// Grants the child process the capability to access URLs with the origin of
|
||||||
// the specified URL.
|
// the specified URL.
|
||||||
|
|
|
@ -191,7 +191,6 @@ const char kAppPath[] = "app-path";
|
||||||
// The command line switch versions of the options.
|
// The command line switch versions of the options.
|
||||||
const char kBackgroundColor[] = "background-color";
|
const char kBackgroundColor[] = "background-color";
|
||||||
const char kPreloadScript[] = "preload";
|
const char kPreloadScript[] = "preload";
|
||||||
const char kPreloadURL[] = "preload-url";
|
|
||||||
const char kPreloadScripts[] = "preload-scripts";
|
const char kPreloadScripts[] = "preload-scripts";
|
||||||
const char kNodeIntegration[] = "node-integration";
|
const char kNodeIntegration[] = "node-integration";
|
||||||
const char kContextIsolation[] = "context-isolation";
|
const char kContextIsolation[] = "context-isolation";
|
||||||
|
|
|
@ -95,7 +95,6 @@ extern const char kAppPath[];
|
||||||
|
|
||||||
extern const char kBackgroundColor[];
|
extern const char kBackgroundColor[];
|
||||||
extern const char kPreloadScript[];
|
extern const char kPreloadScript[];
|
||||||
extern const char kPreloadURL[];
|
|
||||||
extern const char kPreloadScripts[];
|
extern const char kPreloadScripts[];
|
||||||
extern const char kNodeIntegration[];
|
extern const char kNodeIntegration[];
|
||||||
extern const char kContextIsolation[];
|
extern const char kContextIsolation[];
|
||||||
|
|
|
@ -63,8 +63,9 @@ const mergeBrowserWindowOptions = function (embedder, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inherit certain option values from parent window
|
// Inherit certain option values from parent window
|
||||||
|
const webPreferences = embedder.getLastWebPreferences()
|
||||||
for (const [name, value] of inheritedWebPreferences) {
|
for (const [name, value] of inheritedWebPreferences) {
|
||||||
if (embedder.getLastWebPreferences()[name] === value) {
|
if (webPreferences[name] === value) {
|
||||||
options.webPreferences[name] = value
|
options.webPreferences[name] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue