| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_DISPATCHER_H_ | 5 #ifndef EXTENSIONS_RENDERER_DISPATCHER_H_ |
| 6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ | 6 #define EXTENSIONS_RENDERER_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "extensions/renderer/user_script_set_manager.h" | 31 #include "extensions/renderer/user_script_set_manager.h" |
| 32 #include "extensions/renderer/v8_schema_registry.h" | 32 #include "extensions/renderer/v8_schema_registry.h" |
| 33 #include "third_party/WebKit/public/platform/WebString.h" | 33 #include "third_party/WebKit/public/platform/WebString.h" |
| 34 #include "third_party/WebKit/public/platform/WebVector.h" | 34 #include "third_party/WebKit/public/platform/WebVector.h" |
| 35 #include "v8/include/v8.h" | 35 #include "v8/include/v8.h" |
| 36 | 36 |
| 37 class ChromeRenderViewTest; | 37 class ChromeRenderViewTest; |
| 38 class GURL; | 38 class GURL; |
| 39 class ModuleSystem; | 39 class ModuleSystem; |
| 40 class URLPattern; | 40 class URLPattern; |
| 41 struct ExtensionMsg_DispatchEvent_Params; |
| 41 struct ExtensionMsg_ExternalConnectionInfo; | 42 struct ExtensionMsg_ExternalConnectionInfo; |
| 42 struct ExtensionMsg_Loaded_Params; | 43 struct ExtensionMsg_Loaded_Params; |
| 43 struct ExtensionMsg_TabConnectionInfo; | 44 struct ExtensionMsg_TabConnectionInfo; |
| 44 struct ExtensionMsg_UpdatePermissions_Params; | 45 struct ExtensionMsg_UpdatePermissions_Params; |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 class WebFrame; | 48 class WebFrame; |
| 48 class WebLocalFrame; | 49 class WebLocalFrame; |
| 49 class WebSecurityOrigin; | 50 class WebSecurityOrigin; |
| 50 } | 51 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void RunScriptsAtDocumentStart(content::RenderFrame* render_frame); | 124 void RunScriptsAtDocumentStart(content::RenderFrame* render_frame); |
| 124 void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame); | 125 void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame); |
| 125 | 126 |
| 126 void OnExtensionResponse(int request_id, | 127 void OnExtensionResponse(int request_id, |
| 127 bool success, | 128 bool success, |
| 128 const base::ListValue& response, | 129 const base::ListValue& response, |
| 129 const std::string& error); | 130 const std::string& error); |
| 130 | 131 |
| 131 // Dispatches the event named |event_name| to all render views. | 132 // Dispatches the event named |event_name| to all render views. |
| 132 void DispatchEvent(const std::string& extension_id, | 133 void DispatchEvent(const std::string& extension_id, |
| 133 const std::string& event_name) const; | 134 const std::string& event_name, |
| 135 const base::ListValue& event_args, |
| 136 const base::DictionaryValue& filtering_info) const; |
| 134 | 137 |
| 135 // Shared implementation of the various MessageInvoke IPCs. | 138 // Shared implementation of the various MessageInvoke IPCs. |
| 136 void InvokeModuleSystemMethod(content::RenderFrame* render_frame, | 139 void InvokeModuleSystemMethod(content::RenderFrame* render_frame, |
| 137 const std::string& extension_id, | 140 const std::string& extension_id, |
| 138 const std::string& module_name, | 141 const std::string& module_name, |
| 139 const std::string& function_name, | 142 const std::string& function_name, |
| 140 const base::ListValue& args, | 143 const base::ListValue& args); |
| 141 bool user_gesture); | |
| 142 | 144 |
| 143 // Returns a list of (module name, resource id) pairs for the JS modules to | 145 // Returns a list of (module name, resource id) pairs for the JS modules to |
| 144 // add to the source map. | 146 // add to the source map. |
| 145 static std::vector<std::pair<std::string, int> > GetJsResources(); | 147 static std::vector<std::pair<std::string, int> > GetJsResources(); |
| 146 static void RegisterNativeHandlers(ModuleSystem* module_system, | 148 static void RegisterNativeHandlers(ModuleSystem* module_system, |
| 147 ScriptContext* context, | 149 ScriptContext* context, |
| 148 Dispatcher* dispatcher, | 150 Dispatcher* dispatcher, |
| 149 RequestSender* request_sender, | 151 RequestSender* request_sender, |
| 150 V8SchemaRegistry* v8_schema_registry); | 152 V8SchemaRegistry* v8_schema_registry); |
| 151 | 153 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 170 const std::string& channel_name, | 172 const std::string& channel_name, |
| 171 const ExtensionMsg_TabConnectionInfo& source, | 173 const ExtensionMsg_TabConnectionInfo& source, |
| 172 const ExtensionMsg_ExternalConnectionInfo& info, | 174 const ExtensionMsg_ExternalConnectionInfo& info, |
| 173 const std::string& tls_channel_id); | 175 const std::string& tls_channel_id); |
| 174 void OnDispatchOnDisconnect(int port_id, const std::string& error_message); | 176 void OnDispatchOnDisconnect(int port_id, const std::string& error_message); |
| 175 void OnLoaded( | 177 void OnLoaded( |
| 176 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); | 178 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); |
| 177 void OnMessageInvoke(const std::string& extension_id, | 179 void OnMessageInvoke(const std::string& extension_id, |
| 178 const std::string& module_name, | 180 const std::string& module_name, |
| 179 const std::string& function_name, | 181 const std::string& function_name, |
| 180 const base::ListValue& args, | 182 const base::ListValue& args); |
| 181 bool user_gesture); | 183 void OnDispatchEvent(const ExtensionMsg_DispatchEvent_Params& params, |
| 184 const base::ListValue& event_args); |
| 182 void OnSetSessionInfo(version_info::Channel channel, | 185 void OnSetSessionInfo(version_info::Channel channel, |
| 183 FeatureSessionType session_type); | 186 FeatureSessionType session_type); |
| 184 void OnSetScriptingWhitelist( | 187 void OnSetScriptingWhitelist( |
| 185 const ExtensionsClient::ScriptingWhitelist& extension_ids); | 188 const ExtensionsClient::ScriptingWhitelist& extension_ids); |
| 186 void OnSetSystemFont(const std::string& font_family, | 189 void OnSetSystemFont(const std::string& font_family, |
| 187 const std::string& font_size); | 190 const std::string& font_size); |
| 188 void OnSetWebViewPartitionID(const std::string& partition_id); | 191 void OnSetWebViewPartitionID(const std::string& partition_id); |
| 189 void OnShouldSuspend(const std::string& extension_id, uint64_t sequence_id); | 192 void OnShouldSuspend(const std::string& extension_id, uint64_t sequence_id); |
| 190 void OnSuspend(const std::string& extension_id); | 193 void OnSuspend(const std::string& extension_id); |
| 191 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); | 194 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // if this renderer is a WebView guest render process. Otherwise, this will be | 318 // if this renderer is a WebView guest render process. Otherwise, this will be |
| 316 // empty. | 319 // empty. |
| 317 std::string webview_partition_id_; | 320 std::string webview_partition_id_; |
| 318 | 321 |
| 319 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 322 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 320 }; | 323 }; |
| 321 | 324 |
| 322 } // namespace extensions | 325 } // namespace extensions |
| 323 | 326 |
| 324 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ | 327 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ |
| OLD | NEW |