| OLD | NEW |
| 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_EXTENSION_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "content/public/renderer/render_process_observer.h" | 14 #include "content/public/renderer/render_process_observer.h" |
| 15 #include "chrome/common/extensions/event_filter.h" | 15 #include "chrome/common/extensions/event_filter.h" |
| 16 #include "chrome/common/extensions/extension_set.h" | 16 #include "chrome/common/extensions/extension_set.h" |
| 17 #include "chrome/common/extensions/features/feature.h" | 17 #include "chrome/common/extensions/features/feature.h" |
| 18 #include "chrome/renderer/extensions/chrome_v8_context.h" | 18 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 19 #include "chrome/renderer/extensions/chrome_v8_context_set.h" | 19 #include "chrome/renderer/extensions/chrome_v8_context_set.h" |
| 20 #include "chrome/renderer/extensions/v8_schema_registry.h" | 20 #include "chrome/renderer/extensions/v8_schema_registry.h" |
| 21 #include "chrome/renderer/resource_bundle_source_map.h" | 21 #include "chrome/renderer/resource_bundle_source_map.h" |
| 22 #include "v8/include/v8.h" | 22 #include "v8/include/v8.h" |
| 23 | 23 |
| 24 class ExtensionRequestSender; | 24 class ExtensionRequestSender; |
| 25 class GURL; | 25 class GURL; |
| 26 class ModuleSystem; | 26 class ModuleSystem; |
| 27 class URLPattern; | 27 class URLPattern; |
| 28 class UserScriptSlave; | |
| 29 struct ExtensionMsg_Loaded_Params; | 28 struct ExtensionMsg_Loaded_Params; |
| 30 | 29 |
| 31 namespace extensions { | 30 namespace extensions { |
| 32 class FilteredEventRouter; | 31 class FilteredEventRouter; |
| 32 class UserScriptSlave; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace WebKit { | 35 namespace WebKit { |
| 36 class WebFrame; | 36 class WebFrame; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace base { | 39 namespace base { |
| 40 class ListValue; | 40 class ListValue; |
| 41 } | 41 } |
| 42 | 42 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 | 57 |
| 58 const std::set<std::string>& function_names() const { | 58 const std::set<std::string>& function_names() const { |
| 59 return function_names_; | 59 return function_names_; |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool is_extension_process() const { return is_extension_process_; } | 62 bool is_extension_process() const { return is_extension_process_; } |
| 63 const ExtensionSet* extensions() const { return &extensions_; } | 63 const ExtensionSet* extensions() const { return &extensions_; } |
| 64 const ChromeV8ContextSet& v8_context_set() const { | 64 const ChromeV8ContextSet& v8_context_set() const { |
| 65 return v8_context_set_; | 65 return v8_context_set_; |
| 66 } | 66 } |
| 67 UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } | 67 extensions::UserScriptSlave* user_script_slave() { |
| 68 return user_script_slave_.get(); |
| 69 } |
| 68 extensions::V8SchemaRegistry* v8_schema_registry() { | 70 extensions::V8SchemaRegistry* v8_schema_registry() { |
| 69 return &v8_schema_registry_; | 71 return &v8_schema_registry_; |
| 70 } | 72 } |
| 71 | 73 |
| 72 bool IsExtensionActive(const std::string& extension_id) const; | 74 bool IsExtensionActive(const std::string& extension_id) const; |
| 73 | 75 |
| 74 // Finds the extension ID for the JavaScript context associated with the | 76 // Finds the extension ID for the JavaScript context associated with the |
| 75 // specified |frame| and isolated world. If |world_id| is zero, finds the | 77 // specified |frame| and isolated world. If |world_id| is zero, finds the |
| 76 // extension ID associated with the main world's JavaScript context. If the | 78 // extension ID associated with the main world's JavaScript context. If the |
| 77 // JavaScript context isn't from an extension, returns empty string. | 79 // JavaScript context isn't from an extension, returns empty string. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 217 |
| 216 // Contains all loaded extensions. This is essentially the renderer | 218 // Contains all loaded extensions. This is essentially the renderer |
| 217 // counterpart to ExtensionService in the browser. It contains information | 219 // counterpart to ExtensionService in the browser. It contains information |
| 218 // about all extensions currently loaded by the browser. | 220 // about all extensions currently loaded by the browser. |
| 219 ExtensionSet extensions_; | 221 ExtensionSet extensions_; |
| 220 | 222 |
| 221 // All the bindings contexts that are currently loaded for this renderer. | 223 // All the bindings contexts that are currently loaded for this renderer. |
| 222 // There is zero or one for each v8 context. | 224 // There is zero or one for each v8 context. |
| 223 ChromeV8ContextSet v8_context_set_; | 225 ChromeV8ContextSet v8_context_set_; |
| 224 | 226 |
| 225 scoped_ptr<UserScriptSlave> user_script_slave_; | 227 scoped_ptr<extensions::UserScriptSlave> user_script_slave_; |
| 226 | 228 |
| 227 // Same as above, but on a longer timer and will run even if the process is | 229 // Same as above, but on a longer timer and will run even if the process is |
| 228 // not idle, to ensure that IdleHandle gets called eventually. | 230 // not idle, to ensure that IdleHandle gets called eventually. |
| 229 base::RepeatingTimer<content::RenderThread> forced_idle_timer_; | 231 base::RepeatingTimer<content::RenderThread> forced_idle_timer_; |
| 230 | 232 |
| 231 // The v8 extensions which are restricted to extension-related contexts. | 233 // The v8 extensions which are restricted to extension-related contexts. |
| 232 std::set<std::string> restricted_v8_extensions_; | 234 std::set<std::string> restricted_v8_extensions_; |
| 233 | 235 |
| 234 // All declared function names. | 236 // All declared function names. |
| 235 std::set<std::string> function_names_; | 237 std::set<std::string> function_names_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 263 int chrome_channel_; | 265 int chrome_channel_; |
| 264 | 266 |
| 265 // Routes events to the appropriate listener taking into consideration event | 267 // Routes events to the appropriate listener taking into consideration event |
| 266 // filters. | 268 // filters. |
| 267 scoped_ptr<extensions::EventFilter> event_filter_; | 269 scoped_ptr<extensions::EventFilter> event_filter_; |
| 268 | 270 |
| 269 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); | 271 DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher); |
| 270 }; | 272 }; |
| 271 | 273 |
| 272 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ | 274 #endif // CHROME_RENDERER_EXTENSIONS_EXTENSION_DISPATCHER_H_ |
| OLD | NEW |