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

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

Issue 6735004: Move extension messages to their own file and add a RenderViewObserver to start moving the extens... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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.h ('k') | content/common/view_messages.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) 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-inl.h" 9 #include "base/stl_util-inl.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 "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/webui/generic_handler.h" 14 #include "chrome/browser/ui/webui/generic_handler.h"
15 #include "chrome/common/bindings_policy.h" 15 #include "chrome/common/bindings_policy.h"
16 #include "chrome/common/extensions/extension_messages.h"
16 #include "chrome/common/render_messages.h" 17 #include "chrome/common/render_messages.h"
17 #include "chrome/common/render_messages_params.h"
18 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
20 #include "content/browser/tab_contents/tab_contents_view.h" 20 #include "content/browser/tab_contents/tab_contents_view.h"
21 21
22 namespace { 22 namespace {
23 23
24 string16 GetJavascript(const std::string& function_name, 24 string16 GetJavascript(const std::string& function_name,
25 const std::vector<const Value*>& arg_list) { 25 const std::vector<const Value*>& arg_list) {
26 string16 parameters; 26 string16 parameters;
27 std::string json; 27 std::string json;
(...skipping 24 matching lines...) Expand all
52 } 52 }
53 53
54 WebUI::~WebUI() { 54 WebUI::~WebUI() {
55 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(), 55 STLDeleteContainerPairSecondPointers(message_callbacks_.begin(),
56 message_callbacks_.end()); 56 message_callbacks_.end());
57 STLDeleteContainerPointers(handlers_.begin(), handlers_.end()); 57 STLDeleteContainerPointers(handlers_.begin(), handlers_.end());
58 } 58 }
59 59
60 // WebUI, public: ------------------------------------------------------------- 60 // WebUI, public: -------------------------------------------------------------
61 61
62 void WebUI::ProcessWebUIMessage(const ViewHostMsg_DomMessage_Params& params) { 62 void WebUI::ProcessWebUIMessage(
63 const ExtensionHostMsg_DomMessage_Params& params) {
63 // Look up the callback for this message. 64 // Look up the callback for this message.
64 MessageCallbackMap::const_iterator callback = 65 MessageCallbackMap::const_iterator callback =
65 message_callbacks_.find(params.name); 66 message_callbacks_.find(params.name);
66 if (callback == message_callbacks_.end()) 67 if (callback == message_callbacks_.end())
67 return; 68 return;
68 69
69 // Forward this message and content on. 70 // Forward this message and content on.
70 callback->second->Run(&params.arguments); 71 callback->second->Run(&params.arguments);
71 } 72 }
72 73
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return false; 210 return false;
210 } 211 }
211 212
212 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) { 213 string16 WebUIMessageHandler::ExtractStringValue(const ListValue* value) {
213 string16 string16_value; 214 string16 string16_value;
214 if (value->GetString(0, &string16_value)) 215 if (value->GetString(0, &string16_value))
215 return string16_value; 216 return string16_value;
216 NOTREACHED(); 217 NOTREACHED();
217 return string16(); 218 return string16();
218 } 219 }
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698