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

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

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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/browser/worker_host/worker_process_host.cc » ('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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "content/browser/child_process_security_policy_impl.h" 12 #include "content/browser/child_process_security_policy_impl.h"
13 #include "content/browser/renderer_host/render_process_host_impl.h" 13 #include "content/browser/renderer_host/render_process_host_impl.h"
14 #include "content/browser/renderer_host/render_view_host_impl.h" 14 #include "content/browser/renderer_host/render_view_host_impl.h"
15 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
16 #include "content/common/view_messages.h" 16 #include "content/common/view_messages.h"
17 #include "content/public/browser/web_contents_view.h" 17 #include "content/public/browser/web_contents_view.h"
18 #include "content/public/browser/web_ui_controller.h" 18 #include "content/public/browser/web_ui_controller.h"
19 #include "content/public/browser/web_ui_message_handler.h" 19 #include "content/public/browser/web_ui_message_handler.h"
20 #include "content/public/common/bindings_policy.h" 20 #include "content/public/common/bindings_policy.h"
21 #include "ui/base/ui_base_switches.h" 21 #include "ui/base/ui_base_switches.h"
22 22
23 using content::RenderViewHostImpl;
23 using content::WebContents; 24 using content::WebContents;
24 using content::WebUIController; 25 using content::WebUIController;
25 using content::WebUIMessageHandler; 26 using content::WebUIMessageHandler;
26 27
27 namespace content { 28 namespace content {
28 29
29 const WebUI::TypeID WebUI::kNoWebUI = NULL; 30 const WebUI::TypeID WebUI::kNoWebUI = NULL;
30 31
31 // static 32 // static
32 string16 WebUI::GetJavascriptCall( 33 string16 WebUI::GetJavascriptCall(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 // Look up the callback for this message. 91 // Look up the callback for this message.
91 MessageCallbackMap::const_iterator callback = 92 MessageCallbackMap::const_iterator callback =
92 message_callbacks_.find(message); 93 message_callbacks_.find(message);
93 if (callback != message_callbacks_.end()) { 94 if (callback != message_callbacks_.end()) {
94 // Forward this message and content on. 95 // Forward this message and content on.
95 callback->second.Run(&args); 96 callback->second.Run(&args);
96 } 97 }
97 } 98 }
98 99
99 void WebUIImpl::RenderViewCreated(RenderViewHost* render_view_host) { 100 void WebUIImpl::RenderViewCreated(content::RenderViewHost* render_view_host) {
100 controller_->RenderViewCreated(render_view_host); 101 controller_->RenderViewCreated(render_view_host);
101 102
102 // Do not attempt to set the toolkit property if WebUI is not enabled, e.g., 103 // Do not attempt to set the toolkit property if WebUI is not enabled, e.g.,
103 // the bookmarks manager page. 104 // the bookmarks manager page.
104 if (!(bindings_ & content::BINDINGS_POLICY_WEB_UI)) 105 if (!(bindings_ & content::BINDINGS_POLICY_WEB_UI))
105 return; 106 return;
106 107
107 #if defined(TOOLKIT_VIEWS) 108 #if defined(TOOLKIT_VIEWS)
108 render_view_host->SetWebUIProperty("toolkit", "views"); 109 render_view_host->SetWebUIProperty("toolkit", "views");
109 #elif defined(TOOLKIT_GTK) 110 #elif defined(TOOLKIT_GTK)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 handler->set_web_ui(this); 258 handler->set_web_ui(this);
258 handler->RegisterMessages(); 259 handler->RegisterMessages();
259 handlers_.push_back(handler); 260 handlers_.push_back(handler);
260 } 261 }
261 262
262 void WebUIImpl::ExecuteJavascript(const string16& javascript) { 263 void WebUIImpl::ExecuteJavascript(const string16& javascript) {
263 static_cast<RenderViewHostImpl*>( 264 static_cast<RenderViewHostImpl*>(
264 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame( 265 web_contents_->GetRenderViewHost())->ExecuteJavascriptInWebFrame(
265 ASCIIToUTF16(frame_xpath_), javascript); 266 ASCIIToUTF16(frame_xpath_), javascript);
266 } 267 }
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_impl.h ('k') | content/browser/worker_host/worker_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698