| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace base { | 50 namespace base { |
| 51 class ListValue; | 51 class ListValue; |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace extensions { | 54 namespace extensions { |
| 55 class ContentWatcher; | 55 class ContentWatcher; |
| 56 class DispatcherDelegate; | 56 class DispatcherDelegate; |
| 57 class ExtensionBindingsSystem; | 57 class ExtensionBindingsSystem; |
| 58 class RequestSender; | |
| 59 class ScriptContext; | 58 class ScriptContext; |
| 60 class ScriptInjectionManager; | 59 class ScriptInjectionManager; |
| 61 struct Message; | 60 struct Message; |
| 62 struct PortId; | 61 struct PortId; |
| 63 | 62 |
| 64 // Dispatches extension control messages sent to the renderer and stores | 63 // Dispatches extension control messages sent to the renderer and stores |
| 65 // renderer extension related state. | 64 // renderer extension related state. |
| 66 class Dispatcher : public content::RenderThreadObserver, | 65 class Dispatcher : public content::RenderThreadObserver, |
| 67 public UserScriptSetManager::Observer { | 66 public UserScriptSetManager::Observer { |
| 68 public: | 67 public: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 const std::string& module_name, | 131 const std::string& module_name, |
| 133 const std::string& function_name, | 132 const std::string& function_name, |
| 134 const base::ListValue& args); | 133 const base::ListValue& args); |
| 135 | 134 |
| 136 // Returns a list of (module name, resource id) pairs for the JS modules to | 135 // Returns a list of (module name, resource id) pairs for the JS modules to |
| 137 // add to the source map. | 136 // add to the source map. |
| 138 static std::vector<std::pair<const char*, int>> GetJsResources(); | 137 static std::vector<std::pair<const char*, int>> GetJsResources(); |
| 139 static void RegisterNativeHandlers(ModuleSystem* module_system, | 138 static void RegisterNativeHandlers(ModuleSystem* module_system, |
| 140 ScriptContext* context, | 139 ScriptContext* context, |
| 141 Dispatcher* dispatcher, | 140 Dispatcher* dispatcher, |
| 142 RequestSender* request_sender, | 141 ExtensionBindingsSystem* bindings_system, |
| 143 V8SchemaRegistry* v8_schema_registry); | 142 V8SchemaRegistry* v8_schema_registry); |
| 144 | 143 |
| 145 private: | 144 private: |
| 146 // The RendererPermissionsPolicyDelegateTest.CannotScriptWebstore test needs | 145 // The RendererPermissionsPolicyDelegateTest.CannotScriptWebstore test needs |
| 147 // to call the OnActivateExtension IPCs. | 146 // to call the OnActivateExtension IPCs. |
| 148 friend class ::ChromeRenderViewTest; | 147 friend class ::ChromeRenderViewTest; |
| 149 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, | 148 FRIEND_TEST_ALL_PREFIXES(RendererPermissionsPolicyDelegateTest, |
| 150 CannotScriptWebstore); | 149 CannotScriptWebstore); |
| 151 | 150 |
| 152 // RenderThreadObserver implementation: | 151 // RenderThreadObserver implementation: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 void EnableCustomElementWhiteList(); | 213 void EnableCustomElementWhiteList(); |
| 215 | 214 |
| 216 // Adds or removes bindings for every context belonging to |extension_id|, or | 215 // Adds or removes bindings for every context belonging to |extension_id|, or |
| 217 // or all contexts if |extension_id| is empty. | 216 // or all contexts if |extension_id| is empty. |
| 218 void UpdateBindings(const std::string& extension_id); | 217 void UpdateBindings(const std::string& extension_id); |
| 219 | 218 |
| 220 void UpdateBindingsForContext(ScriptContext* context); | 219 void UpdateBindingsForContext(ScriptContext* context); |
| 221 | 220 |
| 222 void RegisterNativeHandlers(ModuleSystem* module_system, | 221 void RegisterNativeHandlers(ModuleSystem* module_system, |
| 223 ScriptContext* context, | 222 ScriptContext* context, |
| 224 RequestSender* request_sender, | 223 ExtensionBindingsSystem* bindings_system, |
| 225 V8SchemaRegistry* v8_schema_registry); | 224 V8SchemaRegistry* v8_schema_registry); |
| 226 | 225 |
| 227 // Updates a web page context with any content capabilities granted by active | 226 // Updates a web page context with any content capabilities granted by active |
| 228 // extensions. | 227 // extensions. |
| 229 void UpdateContentCapabilities(ScriptContext* context); | 228 void UpdateContentCapabilities(ScriptContext* context); |
| 230 | 229 |
| 231 // Inserts static source code into |source_map_|. | 230 // Inserts static source code into |source_map_|. |
| 232 void PopulateSourceMap(); | 231 void PopulateSourceMap(); |
| 233 | 232 |
| 234 // Returns whether the current renderer hosts a platform app. | 233 // Returns whether the current renderer hosts a platform app. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // if this renderer is a WebView guest render process. Otherwise, this will be | 289 // if this renderer is a WebView guest render process. Otherwise, this will be |
| 291 // empty. | 290 // empty. |
| 292 std::string webview_partition_id_; | 291 std::string webview_partition_id_; |
| 293 | 292 |
| 294 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 293 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 295 }; | 294 }; |
| 296 | 295 |
| 297 } // namespace extensions | 296 } // namespace extensions |
| 298 | 297 |
| 299 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ | 298 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ |
| OLD | NEW |