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/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "content/public/renderer/render_process_observer.h" | 17 #include "content/public/renderer/render_process_observer.h" |
18 #include "extensions/common/event_filter.h" | 18 #include "extensions/common/event_filter.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "extensions/common/extension_set.h" | |
21 #include "extensions/common/extensions_client.h" | 20 #include "extensions/common/extensions_client.h" |
22 #include "extensions/common/features/feature.h" | 21 #include "extensions/common/features/feature.h" |
23 #include "extensions/renderer/resource_bundle_source_map.h" | 22 #include "extensions/renderer/resource_bundle_source_map.h" |
24 #include "extensions/renderer/script_context.h" | 23 #include "extensions/renderer/script_context.h" |
25 #include "extensions/renderer/script_context_set.h" | 24 #include "extensions/renderer/script_context_set.h" |
26 #include "extensions/renderer/user_script_set_manager.h" | 25 #include "extensions/renderer/user_script_set_manager.h" |
27 #include "extensions/renderer/v8_schema_registry.h" | 26 #include "extensions/renderer/v8_schema_registry.h" |
28 #include "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
29 #include "third_party/WebKit/public/platform/WebVector.h" | 28 #include "third_party/WebKit/public/platform/WebVector.h" |
30 #include "v8/include/v8.h" | 29 #include "v8/include/v8.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class Dispatcher : public content::RenderProcessObserver, | 66 class Dispatcher : public content::RenderProcessObserver, |
68 public UserScriptSetManager::Observer { | 67 public UserScriptSetManager::Observer { |
69 public: | 68 public: |
70 explicit Dispatcher(DispatcherDelegate* delegate); | 69 explicit Dispatcher(DispatcherDelegate* delegate); |
71 ~Dispatcher() override; | 70 ~Dispatcher() override; |
72 | 71 |
73 const std::set<std::string>& function_names() const { | 72 const std::set<std::string>& function_names() const { |
74 return function_names_; | 73 return function_names_; |
75 } | 74 } |
76 | 75 |
77 const ExtensionSet* extensions() const { return &extensions_; } | |
78 | |
79 const ScriptContextSet& script_context_set() const { | 76 const ScriptContextSet& script_context_set() const { |
80 return *script_context_set_; | 77 return *script_context_set_; |
81 } | 78 } |
82 | 79 |
83 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } | 80 V8SchemaRegistry* v8_schema_registry() { return v8_schema_registry_.get(); } |
84 | 81 |
85 ContentWatcher* content_watcher() { return content_watcher_.get(); } | 82 ContentWatcher* content_watcher() { return content_watcher_.get(); } |
86 | 83 |
87 RequestSender* request_sender() { return request_sender_.get(); } | 84 RequestSender* request_sender() { return request_sender_.get(); } |
88 | 85 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 // Adds features that are specific to the current channel. | 246 // Adds features that are specific to the current channel. |
250 void AddChannelSpecificFeatures(); | 247 void AddChannelSpecificFeatures(); |
251 | 248 |
252 // The delegate for this dispatcher. Not owned, but must extend beyond the | 249 // The delegate for this dispatcher. Not owned, but must extend beyond the |
253 // Dispatcher's own lifetime. | 250 // Dispatcher's own lifetime. |
254 DispatcherDelegate* delegate_; | 251 DispatcherDelegate* delegate_; |
255 | 252 |
256 // True if the IdleNotification timer should be set. | 253 // True if the IdleNotification timer should be set. |
257 bool set_idle_notifications_; | 254 bool set_idle_notifications_; |
258 | 255 |
259 // Contains all loaded extensions. This is essentially the renderer | |
260 // counterpart to ExtensionService in the browser. It contains information | |
261 // about all extensions currently loaded by the browser. | |
262 ExtensionSet extensions_; | |
263 | |
264 // The IDs of extensions that failed to load, mapped to the error message | 256 // The IDs of extensions that failed to load, mapped to the error message |
265 // generated on failure. | 257 // generated on failure. |
266 std::map<std::string, std::string> extension_load_errors_; | 258 std::map<std::string, std::string> extension_load_errors_; |
267 | 259 |
268 // All the bindings contexts that are currently loaded for this renderer. | 260 // All the bindings contexts that are currently loaded for this renderer. |
269 // There is zero or one for each v8 context. | 261 // There is zero or one for each v8 context. |
270 scoped_ptr<ScriptContextSet> script_context_set_; | 262 scoped_ptr<ScriptContextSet> script_context_set_; |
271 | 263 |
272 scoped_ptr<ContentWatcher> content_watcher_; | 264 scoped_ptr<ContentWatcher> content_watcher_; |
273 | 265 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 302 |
311 // Status of webrequest usage. | 303 // Status of webrequest usage. |
312 bool webrequest_used_; | 304 bool webrequest_used_; |
313 | 305 |
314 DISALLOW_COPY_AND_ASSIGN(Dispatcher); | 306 DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
315 }; | 307 }; |
316 | 308 |
317 } // namespace extensions | 309 } // namespace extensions |
318 | 310 |
319 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ | 311 #endif // EXTENSIONS_RENDERER_DISPATCHER_H_ |
OLD | NEW |