| 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_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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 namespace base { | 33 namespace base { |
| 34 class ListValue; | 34 class ListValue; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| 38 class RenderThread; | 38 class RenderThread; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace extensions { | 41 namespace extensions { |
| 42 class ContentWatcher; |
| 42 class Extension; | 43 class Extension; |
| 43 class FilteredEventRouter; | 44 class FilteredEventRouter; |
| 44 class RequestSender; | 45 class RequestSender; |
| 45 class UserScriptSlave; | 46 class UserScriptSlave; |
| 46 | 47 |
| 47 // Dispatches extension control messages sent to the renderer and stores | 48 // Dispatches extension control messages sent to the renderer and stores |
| 48 // renderer extension related state. | 49 // renderer extension related state. |
| 49 class Dispatcher : public content::RenderProcessObserver { | 50 class Dispatcher : public content::RenderProcessObserver { |
| 50 public: | 51 public: |
| 51 Dispatcher(); | 52 Dispatcher(); |
| 52 virtual ~Dispatcher(); | 53 virtual ~Dispatcher(); |
| 53 | 54 |
| 54 const std::set<std::string>& function_names() const { | 55 const std::set<std::string>& function_names() const { |
| 55 return function_names_; | 56 return function_names_; |
| 56 } | 57 } |
| 57 | 58 |
| 58 bool is_extension_process() const { return is_extension_process_; } | 59 bool is_extension_process() const { return is_extension_process_; } |
| 59 const ExtensionSet* extensions() const { return &extensions_; } | 60 const ExtensionSet* extensions() const { return &extensions_; } |
| 60 const ChromeV8ContextSet& v8_context_set() const { | 61 const ChromeV8ContextSet& v8_context_set() const { |
| 61 return v8_context_set_; | 62 return v8_context_set_; |
| 62 } | 63 } |
| 63 UserScriptSlave* user_script_slave() { | 64 UserScriptSlave* user_script_slave() { |
| 64 return user_script_slave_.get(); | 65 return user_script_slave_.get(); |
| 65 } | 66 } |
| 66 V8SchemaRegistry* v8_schema_registry() { | 67 V8SchemaRegistry* v8_schema_registry() { |
| 67 return &v8_schema_registry_; | 68 return &v8_schema_registry_; |
| 68 } | 69 } |
| 70 ContentWatcher* content_watcher() { |
| 71 return content_watcher_.get(); |
| 72 } |
| 69 | 73 |
| 70 bool IsExtensionActive(const std::string& extension_id) const; | 74 bool IsExtensionActive(const std::string& extension_id) const; |
| 71 | 75 |
| 72 // Finds the extension ID for the JavaScript context associated with the | 76 // Finds the extension ID for the JavaScript context associated with the |
| 73 // 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 |
| 74 // 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 |
| 75 // JavaScript context isn't from an extension, returns empty string. | 79 // JavaScript context isn't from an extension, returns empty string. |
| 76 std::string GetExtensionID(const WebKit::WebFrame* frame, int world_id); | 80 std::string GetExtensionID(const WebKit::WebFrame* frame, int world_id); |
| 77 | 81 |
| 78 // See WebKit::WebPermissionClient::allowScriptExtension | 82 // See WebKit::WebPermissionClient::allowScriptExtension |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // counterpart to ExtensionService in the browser. It contains information | 218 // counterpart to ExtensionService in the browser. It contains information |
| 215 // about all extensions currently loaded by the browser. | 219 // about all extensions currently loaded by the browser. |
| 216 ExtensionSet extensions_; | 220 ExtensionSet extensions_; |
| 217 | 221 |
| 218 // All the bindings contexts that are currently loaded for this renderer. | 222 // All the bindings contexts that are currently loaded for this renderer. |
| 219 // There is zero or one for each v8 context. | 223 // There is zero or one for each v8 context. |
| 220 ChromeV8ContextSet v8_context_set_; | 224 ChromeV8ContextSet v8_context_set_; |
| 221 | 225 |
| 222 scoped_ptr<UserScriptSlave> user_script_slave_; | 226 scoped_ptr<UserScriptSlave> user_script_slave_; |
| 223 | 227 |
| 228 scoped_ptr<ContentWatcher> content_watcher_; |
| 229 |
| 224 // Same as above, but on a longer timer and will run even if the process is | 230 // Same as above, but on a longer timer and will run even if the process is |
| 225 // not idle, to ensure that IdleHandle gets called eventually. | 231 // not idle, to ensure that IdleHandle gets called eventually. |
| 226 base::RepeatingTimer<content::RenderThread> forced_idle_timer_; | 232 base::RepeatingTimer<content::RenderThread> forced_idle_timer_; |
| 227 | 233 |
| 228 // All declared function names. | 234 // All declared function names. |
| 229 std::set<std::string> function_names_; | 235 std::set<std::string> function_names_; |
| 230 | 236 |
| 231 // The extensions and apps that are active in this process. | 237 // The extensions and apps that are active in this process. |
| 232 std::set<std::string> active_extension_ids_; | 238 std::set<std::string> active_extension_ids_; |
| 233 | 239 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 251 | 257 |
| 252 // Sends API requests to the extension host. | 258 // Sends API requests to the extension host. |
| 253 scoped_ptr<RequestSender> request_sender_; | 259 scoped_ptr<RequestSender> request_sender_; |
| 254 | 260 |
| 255 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 261 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
| 256 }; | 262 }; |
| 257 | 263 |
| 258 } // namespace extensions | 264 } // namespace extensions |
| 259 | 265 |
| 260 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ | 266 #endif // CHROME_RENDERER_EXTENSIONS_DISPATCHER_H_ |
| OLD | NEW |