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

Side by Side Diff: chrome/renderer/extensions/dispatcher.h

Issue 15855010: Make ExtensionMsg_MessageInvoke run a module system function rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: go Created 7 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
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 #ifndef CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_
6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bool success, 122 bool success,
123 const base::ListValue& response, 123 const base::ListValue& response,
124 const std::string& error); 124 const std::string& error);
125 125
126 // Checks that the current context contains an extension that has permission 126 // Checks that the current context contains an extension that has permission
127 // to execute the specified function. If it does not, a v8 exception is thrown 127 // to execute the specified function. If it does not, a v8 exception is thrown
128 // and the method returns false. Otherwise returns true. 128 // and the method returns false. Otherwise returns true.
129 bool CheckContextAccessToExtensionAPI( 129 bool CheckContextAccessToExtensionAPI(
130 const std::string& function_name, ChromeV8Context* context) const; 130 const std::string& function_name, ChromeV8Context* context) const;
131 131
132 // Dispatches the event named |event_name| to all render views.
133 void DispatchEvent(const std::string& extension_id,
134 const std::string& event_name) const;
135
136 // Calls a method |method_name| in a module |module_name| belonging to the
137 // module system from |context|. Intended as a callback target from
138 // ChromeV8ContextSet::ForEach. Public to be called from ExtensionHelper.
139 static void CallModuleMethod(const std::string& module_name,
140 const std::string& method_name,
141 const base::ListValue* args,
142 ChromeV8Context* context);
143
132 private: 144 private:
133 friend class RenderViewTest; 145 friend class RenderViewTest;
134 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, 146 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest,
135 CannotScriptWebstore); 147 CannotScriptWebstore);
136 typedef void (*BindingInstaller)(ModuleSystem* module_system, 148 typedef void (*BindingInstaller)(ModuleSystem* module_system,
137 v8::Handle<v8::Object> chrome, 149 v8::Handle<v8::Object> chrome,
138 v8::Handle<v8::Object> chrome_hidden); 150 v8::Handle<v8::Object> chrome_hidden);
139 151
140 // RenderProcessObserver implementation: 152 // RenderProcessObserver implementation:
141 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; 153 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
142 virtual void WebKitInitialized() OVERRIDE; 154 virtual void WebKitInitialized() OVERRIDE;
143 virtual void IdleNotification() OVERRIDE; 155 virtual void IdleNotification() OVERRIDE;
144 156
145 void OnSetChannel(int channel); 157 void OnSetChannel(int channel);
146 void OnMessageInvoke(const std::string& extension_id, 158 void OnMessageInvoke(const std::string& extension_id,
159 const std::string& module_name,
147 const std::string& function_name, 160 const std::string& function_name,
148 const base::ListValue& args, 161 const base::ListValue& args,
149 bool user_gesture); 162 bool user_gesture);
150 void OnDispatchOnConnect(int target_port_id, 163 void OnDispatchOnConnect(int target_port_id,
151 const std::string& channel_name, 164 const std::string& channel_name,
152 const base::DictionaryValue& source_tab, 165 const base::DictionaryValue& source_tab,
153 const ExtensionMsg_ExternalConnectionInfo& info); 166 const ExtensionMsg_ExternalConnectionInfo& info);
154 void OnDeliverMessage(int target_port_id, const base::ListValue& message); 167 void OnDeliverMessage(int target_port_id, const base::ListValue& message);
155 void OnDispatchOnDisconnect(int port_id, const std::string& error_message); 168 void OnDispatchOnDisconnect(int port_id, const std::string& error_message);
156 void OnSetFunctionNames(const std::vector<std::string>& names); 169 void OnSetFunctionNames(const std::vector<std::string>& names);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 288
276 // Sends API requests to the extension host. 289 // Sends API requests to the extension host.
277 scoped_ptr<RequestSender> request_sender_; 290 scoped_ptr<RequestSender> request_sender_;
278 291
279 DISALLOW_COPY_AND_ASSIGN(Dispatcher); 292 DISALLOW_COPY_AND_ASSIGN(Dispatcher);
280 }; 293 };
281 294
282 } // namespace extensions 295 } // namespace extensions
283 296
284 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ 297 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698