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

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

Issue 8515027: Define the public version of the browser side RenderProcessHost interface. This interface is not ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "content/browser/webui/web_ui.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.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/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "content/browser/child_process_security_policy.h" 13 #include "content/browser/child_process_security_policy.h"
14 #include "content/browser/renderer_host/render_process_host.h" 14 #include "content/browser/renderer_host/render_process_host_impl.h"
15 #include "content/browser/renderer_host/render_view_host.h" 15 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/browser/tab_contents/tab_contents.h" 16 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/browser/tab_contents/tab_contents_view.h" 17 #include "content/browser/tab_contents/tab_contents_view.h"
18 #include "content/browser/webui/generic_handler.h" 18 #include "content/browser/webui/generic_handler.h"
19 #include "content/common/view_messages.h" 19 #include "content/common/view_messages.h"
20 #include "content/public/common/bindings_policy.h" 20 #include "content/public/common/bindings_policy.h"
21 #include "ipc/ipc_message.h" 21 #include "ipc/ipc_message.h"
22 #include "ipc/ipc_message_macros.h" 22 #include "ipc/ipc_message_macros.h"
23 23
24 // static 24 // static
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) 65 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
66 IPC_MESSAGE_UNHANDLED(handled = false) 66 IPC_MESSAGE_UNHANDLED(handled = false)
67 IPC_END_MESSAGE_MAP() 67 IPC_END_MESSAGE_MAP()
68 return handled; 68 return handled;
69 } 69 }
70 70
71 void WebUI::OnWebUISend(const GURL& source_url, 71 void WebUI::OnWebUISend(const GURL& source_url,
72 const std::string& message, 72 const std::string& message,
73 const ListValue& args) { 73 const ListValue& args) {
74 if (!ChildProcessSecurityPolicy::GetInstance()-> 74 if (!ChildProcessSecurityPolicy::GetInstance()->
75 HasWebUIBindings(tab_contents_->GetRenderProcessHost()->id())) { 75 HasWebUIBindings(tab_contents_->GetRenderProcessHost()->GetID())) {
76 NOTREACHED() << "Blocked unauthorized use of WebUIBindings."; 76 NOTREACHED() << "Blocked unauthorized use of WebUIBindings.";
77 return; 77 return;
78 } 78 }
79 79
80 // Look up the callback for this message. 80 // Look up the callback for this message.
81 MessageCallbackMap::const_iterator callback = 81 MessageCallbackMap::const_iterator callback =
82 message_callbacks_.find(message); 82 message_callbacks_.find(message);
83 if (callback != message_callbacks_.end()) { 83 if (callback != message_callbacks_.end()) {
84 // Forward this message and content on. 84 // Forward this message and content on.
85 callback->second.Run(&args); 85 callback->second.Run(&args);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 return false; 228 return false;
229 } 229 }
230 230
231 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { 231 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) {
232 string16 string16_value; 232 string16 string16_value;
233 if (value->GetString(0, &string16_value)) 233 if (value->GetString(0, &string16_value))
234 return string16_value; 234 return string16_value;
235 NOTREACHED(); 235 NOTREACHED();
236 return string16(); 236 return string16();
237 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698