refactor: make methods const, cleanup (#13937)

This commit is contained in:
Milan Burda 2018-08-09 19:15:23 +02:00 committed by Shelley Vohr
parent 9005803667
commit 271d582aac
5 changed files with 15 additions and 15 deletions

View file

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

View file

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