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);
|
||||
}
|
||||
|
||||
double WebContents::GetZoomLevel() {
|
||||
double WebContents::GetZoomLevel() const {
|
||||
return zoom_controller_->GetZoomLevel();
|
||||
}
|
||||
|
||||
|
@ -1863,7 +1863,7 @@ void WebContents::SetZoomFactor(double factor) {
|
|||
SetZoomLevel(level);
|
||||
}
|
||||
|
||||
double WebContents::GetZoomFactor() {
|
||||
double WebContents::GetZoomFactor() const {
|
||||
auto level = GetZoomLevel();
|
||||
return content::ZoomLevelToZoomFactor(level);
|
||||
}
|
||||
|
@ -1884,22 +1884,23 @@ void WebContents::OnGetZoomLevel(content::RenderFrameHost* rfh,
|
|||
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());
|
||||
if (!web_preferences)
|
||||
return v8::Null(isolate);
|
||||
return mate::ConvertToV8(isolate, *web_preferences->preference());
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> WebContents::GetLastWebPreferences(v8::Isolate* isolate) {
|
||||
WebContentsPreferences* web_preferences =
|
||||
WebContentsPreferences::FromWebContents(web_contents());
|
||||
v8::Local<v8::Value> WebContents::GetLastWebPreferences(
|
||||
v8::Isolate* isolate) const {
|
||||
auto* web_preferences = WebContentsPreferences::From(web_contents());
|
||||
if (!web_preferences)
|
||||
return v8::Null(isolate);
|
||||
return mate::ConvertToV8(isolate, *web_preferences->last_preference());
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() {
|
||||
v8::Local<v8::Value> WebContents::GetOwnerBrowserWindow() const {
|
||||
if (owner_window())
|
||||
return BrowserWindow::From(isolate(), owner_window());
|
||||
else
|
||||
|
|
|
@ -213,9 +213,9 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
|
||||
// Methods for zoom handling.
|
||||
void SetZoomLevel(double level);
|
||||
double GetZoomLevel();
|
||||
double GetZoomLevel() const;
|
||||
void SetZoomFactor(double factor);
|
||||
double GetZoomFactor();
|
||||
double GetZoomFactor() const;
|
||||
|
||||
// Callback triggered on permission response.
|
||||
void OnEnterFullscreenModeForTab(content::WebContents* source,
|
||||
|
@ -231,11 +231,11 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
|||
const scoped_refptr<network::ResourceRequestBody>& body);
|
||||
|
||||
// Returns the web preferences of current WebContents.
|
||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> GetLastWebPreferences(v8::Isolate* isolate);
|
||||
v8::Local<v8::Value> GetWebPreferences(v8::Isolate* isolate) const;
|
||||
v8::Local<v8::Value> GetLastWebPreferences(v8::Isolate* isolate) const;
|
||||
|
||||
// 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
|
||||
// the specified URL.
|
||||
|
|
|
@ -191,7 +191,6 @@ const char kAppPath[] = "app-path";
|
|||
// The command line switch versions of the options.
|
||||
const char kBackgroundColor[] = "background-color";
|
||||
const char kPreloadScript[] = "preload";
|
||||
const char kPreloadURL[] = "preload-url";
|
||||
const char kPreloadScripts[] = "preload-scripts";
|
||||
const char kNodeIntegration[] = "node-integration";
|
||||
const char kContextIsolation[] = "context-isolation";
|
||||
|
|
|
@ -95,7 +95,6 @@ extern const char kAppPath[];
|
|||
|
||||
extern const char kBackgroundColor[];
|
||||
extern const char kPreloadScript[];
|
||||
extern const char kPreloadURL[];
|
||||
extern const char kPreloadScripts[];
|
||||
extern const char kNodeIntegration[];
|
||||
extern const char kContextIsolation[];
|
||||
|
|
|
@ -63,8 +63,9 @@ const mergeBrowserWindowOptions = function (embedder, options) {
|
|||
}
|
||||
|
||||
// Inherit certain option values from parent window
|
||||
const webPreferences = embedder.getLastWebPreferences()
|
||||
for (const [name, value] of inheritedWebPreferences) {
|
||||
if (embedder.getLastWebPreferences()[name] === value) {
|
||||
if (webPreferences[name] === value) {
|
||||
options.webPreferences[name] = value
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue