| OLD | NEW |
| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 web_contents_->GetBrowserContext(), source_url)) { | 76 web_contents_->GetBrowserContext(), source_url)) { |
| 77 NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; | 77 NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 | 80 |
| 81 ProcessWebUIMessage(source_url, message, args); | 81 ProcessWebUIMessage(source_url, message, args); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void WebUIImpl::RenderViewCreated(RenderViewHost* render_view_host) { | 84 void WebUIImpl::RenderViewCreated(RenderViewHost* render_view_host) { |
| 85 controller_->RenderViewCreated(render_view_host); | 85 controller_->RenderViewCreated(render_view_host); |
| 86 | |
| 87 // Do not attempt to set the toolkit property if WebUI is not enabled, e.g., | |
| 88 // the bookmarks manager page. | |
| 89 if (!(bindings_ & BINDINGS_POLICY_WEB_UI)) | |
| 90 return; | |
| 91 | |
| 92 #if defined(TOOLKIT_VIEWS) | |
| 93 render_view_host->SetWebUIProperty("toolkit", "views"); | |
| 94 #endif // defined(TOOLKIT_VIEWS) | |
| 95 } | 86 } |
| 96 | 87 |
| 97 WebContents* WebUIImpl::GetWebContents() const { | 88 WebContents* WebUIImpl::GetWebContents() const { |
| 98 return web_contents_; | 89 return web_contents_; |
| 99 } | 90 } |
| 100 | 91 |
| 101 float WebUIImpl::GetDeviceScaleFactor() const { | 92 float WebUIImpl::GetDeviceScaleFactor() const { |
| 102 return GetScaleFactorForView(web_contents_->GetRenderWidgetHostView()); | 93 return GetScaleFactorForView(web_contents_->GetRenderWidgetHostView()); |
| 103 } | 94 } |
| 104 | 95 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 241 } |
| 251 | 242 |
| 252 void WebUIImpl::AddToSetIfFrameNameMatches( | 243 void WebUIImpl::AddToSetIfFrameNameMatches( |
| 253 std::set<RenderFrameHost*>* frame_set, | 244 std::set<RenderFrameHost*>* frame_set, |
| 254 RenderFrameHost* host) { | 245 RenderFrameHost* host) { |
| 255 if (host->GetFrameName() == frame_name_) | 246 if (host->GetFrameName() == frame_name_) |
| 256 frame_set->insert(host); | 247 frame_set->insert(host); |
| 257 } | 248 } |
| 258 | 249 |
| 259 } // namespace content | 250 } // namespace content |
| OLD | NEW |