| 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "content/public/renderer/render_process_observer.h" | 16 #include "content/public/renderer/render_process_observer.h" |
| 17 #include "extensions/common/event_filter.h" | 17 #include "extensions/common/event_filter.h" |
| 18 #include "extensions/common/extension_set.h" | 18 #include "extensions/common/extension_set.h" |
| 19 #include "extensions/common/extensions_client.h" | 19 #include "extensions/common/extensions_client.h" |
| 20 #include "extensions/common/features/feature.h" | 20 #include "extensions/common/features/feature.h" |
| 21 #include "extensions/renderer/resource_bundle_source_map.h" | 21 #include "extensions/renderer/resource_bundle_source_map.h" |
| 22 #include "extensions/renderer/script_context.h" | 22 #include "extensions/renderer/script_context.h" |
| 23 #include "extensions/renderer/script_context_set.h" | 23 #include "extensions/renderer/script_context_set.h" |
| 24 #include "extensions/renderer/user_script_set.h" | 24 #include "extensions/renderer/user_script_set_manager.h" |
| 25 #include "extensions/renderer/v8_schema_registry.h" | 25 #include "extensions/renderer/v8_schema_registry.h" |
| 26 #include "third_party/WebKit/public/platform/WebString.h" | 26 #include "third_party/WebKit/public/platform/WebString.h" |
| 27 #include "third_party/WebKit/public/platform/WebVector.h" | 27 #include "third_party/WebKit/public/platform/WebVector.h" |
| 28 #include "v8/include/v8.h" | 28 #include "v8/include/v8.h" |
| 29 | 29 |
| 30 class ChromeRenderViewTest; | 30 class ChromeRenderViewTest; |
| 31 class GURL; | 31 class GURL; |
| 32 class ModuleSystem; | 32 class ModuleSystem; |
| 33 class URLPattern; | 33 class URLPattern; |
| 34 struct ExtensionMsg_ExternalConnectionInfo; | 34 struct ExtensionMsg_ExternalConnectionInfo; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 class FilteredEventRouter; | 56 class FilteredEventRouter; |
| 57 class ManifestPermissionSet; | 57 class ManifestPermissionSet; |
| 58 class RequestSender; | 58 class RequestSender; |
| 59 class ScriptContext; | 59 class ScriptContext; |
| 60 class ScriptInjectionManager; | 60 class ScriptInjectionManager; |
| 61 struct Message; | 61 struct Message; |
| 62 | 62 |
| 63 // Dispatches extension control messages sent to the renderer and stores | 63 // Dispatches extension control messages sent to the renderer and stores |
| 64 // renderer extension related state. | 64 // renderer extension related state. |
| 65 class Dispatcher : public content::RenderProcessObserver, | 65 class Dispatcher : public content::RenderProcessObserver, |
| 66 public UserScriptSet::Observer { | 66 public UserScriptSetManager::Observer { |
| 67 public: | 67 public: |
| 68 explicit Dispatcher(DispatcherDelegate* delegate); | 68 explicit Dispatcher(DispatcherDelegate* delegate); |
| 69 virtual ~Dispatcher(); | 69 virtual ~Dispatcher(); |
| 70 | 70 |
| 71 const std::set<std::string>& function_names() const { | 71 const std::set<std::string>& function_names() const { |
| 72 return function_names_; | 72 return function_names_; |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool is_extension_process() const { return is_extension_process_; } | 75 bool is_extension_process() const { return is_extension_process_; } |
| 76 | 76 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 void OnSuspend(const std::string& extension_id); | 187 void OnSuspend(const std::string& extension_id); |
| 188 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); | 188 void OnTransferBlobs(const std::vector<std::string>& blob_uuids); |
| 189 void OnUnloaded(const std::string& id); | 189 void OnUnloaded(const std::string& id); |
| 190 void OnUpdatePermissions(const ExtensionMsg_UpdatePermissions_Params& params); | 190 void OnUpdatePermissions(const ExtensionMsg_UpdatePermissions_Params& params); |
| 191 void OnUpdateTabSpecificPermissions(const GURL& url, | 191 void OnUpdateTabSpecificPermissions(const GURL& url, |
| 192 int tab_id, | 192 int tab_id, |
| 193 const std::string& extension_id, | 193 const std::string& extension_id, |
| 194 const URLPatternSet& origin_set); | 194 const URLPatternSet& origin_set); |
| 195 void OnUsingWebRequestAPI(bool webrequest_used); | 195 void OnUsingWebRequestAPI(bool webrequest_used); |
| 196 | 196 |
| 197 // UserScriptSet::Observer implementation. | 197 // UserScriptSetManager::Observer implementation. |
| 198 virtual void OnUserScriptsUpdated( | 198 virtual void OnUserScriptsUpdated( |
| 199 const std::set<std::string>& changed_extensions, | 199 const std::set<std::string>& changed_extensions, |
| 200 const std::vector<UserScript*>& scripts) OVERRIDE; | 200 const std::vector<UserScript*>& scripts) OVERRIDE; |
| 201 | 201 |
| 202 void UpdateActiveExtensions(); | 202 void UpdateActiveExtensions(); |
| 203 | 203 |
| 204 // Sets up the host permissions for |extension|. | 204 // Sets up the host permissions for |extension|. |
| 205 void InitOriginPermissions(const Extension* extension); | 205 void InitOriginPermissions(const Extension* extension); |
| 206 | 206 |
| 207 // Updates the host permissions for extension to include only those in | 207 // Updates the host permissions for extension to include only those in |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // The IDs of extensions that failed to load, mapped to the error message | 265 // The IDs of extensions that failed to load, mapped to the error message |
| 266 // generated on failure. | 266 // generated on failure. |
| 267 std::map<std::string, std::string> extension_load_errors_; | 267 std::map<std::string, std::string> extension_load_errors_; |
| 268 | 268 |
| 269 // All the bindings contexts that are currently loaded for this renderer. | 269 // All the bindings contexts that are currently loaded for this renderer. |
| 270 // There is zero or one for each v8 context. | 270 // There is zero or one for each v8 context. |
| 271 ScriptContextSet script_context_set_; | 271 ScriptContextSet script_context_set_; |
| 272 | 272 |
| 273 scoped_ptr<ContentWatcher> content_watcher_; | 273 scoped_ptr<ContentWatcher> content_watcher_; |
| 274 | 274 |
| 275 scoped_ptr<UserScriptSet> user_script_set_; | 275 scoped_ptr<UserScriptSetManager> user_script_set_manager_; |
| 276 | 276 |
| 277 scoped_ptr<ScriptInjectionManager> script_injection_manager_; | 277 scoped_ptr<ScriptInjectionManager> script_injection_manager_; |
| 278 | 278 |
| 279 // Same as above, but on a longer timer and will run even if the process is | 279 // Same as above, but on a longer timer and will run even if the process is |
| 280 // not idle, to ensure that IdleHandle gets called eventually. | 280 // not idle, to ensure that IdleHandle gets called eventually. |
| 281 scoped_ptr<base::RepeatingTimer<content::RenderThread> > forced_idle_timer_; | 281 scoped_ptr<base::RepeatingTimer<content::RenderThread> > forced_idle_timer_; |
| 282 | 282 |
| 283 // All declared function names. | 283 // All declared function names. |
| 284 std::set<std::string> function_names_; | 284 std::set<std::string> function_names_; |
| 285 | 285 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 299 std::string system_font_size_; | 299 std::string system_font_size_; |
| 300 | 300 |
| 301 // Mapping of port IDs to tabs. If there is no tab, the value would be -1. | 301 // Mapping of port IDs to tabs. If there is no tab, the value would be -1. |
| 302 std::map<int, int> port_to_tab_id_map_; | 302 std::map<int, int> port_to_tab_id_map_; |
| 303 | 303 |
| 304 // True once WebKit has been initialized (and it is therefore safe to poke). | 304 // True once WebKit has been initialized (and it is therefore safe to poke). |
| 305 bool is_webkit_initialized_; | 305 bool is_webkit_initialized_; |
| 306 | 306 |
| 307 // It is important for this to come after the ScriptInjectionManager, so that | 307 // It is important for this to come after the ScriptInjectionManager, so that |
| 308 // the observer is destroyed before the UserScriptSet. | 308 // the observer is destroyed before the UserScriptSet. |
| 309 ScopedObserver<UserScriptSet, UserScriptSet::Observer> | 309 ScopedObserver<UserScriptSetManager, UserScriptSetManager::Observer> |
| 310 user_script_set_observer_; | 310 user_script_set_manager_observer_; |
| 311 | 311 |
| 312 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 312 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 313 }; | 313 }; |
| 314 | 314 |
| 315 } // namespace extensions | 315 } // namespace extensions |
| 316 | 316 |
| 317 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ | 317 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ |
| OLD | NEW |