Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: content/browser/webui/web_ui_impl.cc

Issue 10535134: Add WebUI::GetDeviceScale (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/webui/web_ui_impl.h ('k') | content/public/browser/web_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/webui/web_ui_impl.h" 5 #include "content/browser/webui/web_ui_impl.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "content/browser/child_process_security_policy_impl.h" 11 #include "content/browser/child_process_security_policy_impl.h"
12 #include "content/browser/renderer_host/dip_util.h"
12 #include "content/browser/renderer_host/render_process_host_impl.h" 13 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
14 #include "content/browser/web_contents/web_contents_impl.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
15 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
18 #include "content/public/browser/web_contents_view.h" 19 #include "content/public/browser/web_contents_view.h"
19 #include "content/public/browser/web_ui_controller.h" 20 #include "content/public/browser/web_ui_controller.h"
20 #include "content/public/browser/web_ui_controller_factory.h" 21 #include "content/public/browser/web_ui_controller_factory.h"
21 #include "content/public/browser/web_ui_message_handler.h" 22 #include "content/public/browser/web_ui_message_handler.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 render_view_host->SetWebUIProperty("toolkit", "views"); 110 render_view_host->SetWebUIProperty("toolkit", "views");
110 #elif defined(TOOLKIT_GTK) 111 #elif defined(TOOLKIT_GTK)
111 render_view_host->SetWebUIProperty("toolkit", "GTK"); 112 render_view_host->SetWebUIProperty("toolkit", "GTK");
112 #endif // defined(TOOLKIT_VIEWS) 113 #endif // defined(TOOLKIT_VIEWS)
113 } 114 }
114 115
115 WebContents* WebUIImpl::GetWebContents() const { 116 WebContents* WebUIImpl::GetWebContents() const {
116 return web_contents_; 117 return web_contents_;
117 } 118 }
118 119
120 float WebUIImpl::GetDeviceScale() const {
121 return GetDIPScaleFactor(web_contents_->GetRenderWidgetHostView());
122 }
123
119 bool WebUIImpl::ShouldHideFavicon() const { 124 bool WebUIImpl::ShouldHideFavicon() const {
120 return hide_favicon_; 125 return hide_favicon_;
121 } 126 }
122 127
123 void WebUIImpl::HideFavicon() { 128 void WebUIImpl::HideFavicon() {
124 hide_favicon_ = true; 129 hide_favicon_ = true;
125 } 130 }
126 131
127 bool WebUIImpl::ShouldFocusLocationBarByDefault() const { 132 bool WebUIImpl::ShouldFocusLocationBarByDefault() const {
128 return focus_location_bar_by_default_; 133 return focus_location_bar_by_default_;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 handler->set_web_ui(this); 265 handler->set_web_ui(this);
261 handler->RegisterMessages(); 266 handler->RegisterMessages();
262 handlers_.push_back(handler); 267 handlers_.push_back(handler);
263 } 268 }
264 269
265 void WebUIImpl::ExecuteJavascript(const string16& javascript) { 270 void WebUIImpl::ExecuteJavascript(const string16& javascript) {
266 static_cast<RenderViewHostImpl*>( 271 static_cast<RenderViewHostImpl*>(
267 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame( 272 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame(
268 ASCIIToUTF16(frame_xpath_), javascript); 273 ASCIIToUTF16(frame_xpath_), javascript);
269 } 274 }
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.h ('k') | content/public/browser/web_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698