Index: extensions/renderer/dispatcher.h |
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h |
index aaf2724d8a66edccfd758e43d1cfe78c0a51ebb4..816c7310dc886b90353f0df756051f65044658c7 100644 |
--- a/extensions/renderer/dispatcher.h |
+++ b/extensions/renderer/dispatcher.h |
@@ -10,7 +10,7 @@ |
#include <string> |
#include <vector> |
-#include "base/memory/shared_memory.h" |
+#include "base/scoped_observer.h" |
#include "base/timer/timer.h" |
#include "content/public/renderer/render_process_observer.h" |
#include "extensions/common/event_filter.h" |
@@ -20,6 +20,7 @@ |
#include "extensions/renderer/resource_bundle_source_map.h" |
#include "extensions/renderer/script_context.h" |
#include "extensions/renderer/script_context_set.h" |
+#include "extensions/renderer/user_script_injection_list.h" |
#include "extensions/renderer/v8_schema_registry.h" |
#include "third_party/WebKit/public/platform/WebString.h" |
#include "third_party/WebKit/public/platform/WebVector.h" |
@@ -55,12 +56,13 @@ class FilteredEventRouter; |
class ManifestPermissionSet; |
class RequestSender; |
class ScriptContext; |
-class UserScriptSlave; |
+class ScriptInjectionManager; |
struct Message; |
// Dispatches extension control messages sent to the renderer and stores |
// renderer extension related state. |
-class Dispatcher : public content::RenderProcessObserver { |
+class Dispatcher : public content::RenderProcessObserver, |
+ public UserScriptInjectionList::Observer { |
public: |
explicit Dispatcher(DispatcherDelegate* delegate); |
virtual ~Dispatcher(); |
@@ -81,10 +83,10 @@ class Dispatcher : public content::RenderProcessObserver { |
ContentWatcher* content_watcher() { return content_watcher_.get(); } |
- UserScriptSlave* user_script_slave() { return user_script_slave_.get(); } |
- |
RequestSender* request_sender() { return request_sender_.get(); } |
+ void OnRenderViewCreated(content::RenderView* render_view); |
+ |
bool IsExtensionActive(const std::string& extension_id) const; |
// Finds the extension ID for the JavaScript context associated with the |
@@ -180,12 +182,15 @@ class Dispatcher : public content::RenderProcessObserver { |
int tab_id, |
const std::string& extension_id, |
const URLPatternSet& origin_set); |
- void OnUpdateUserScripts(base::SharedMemoryHandle scripts, |
- const std::set<std::string>& extension_ids); |
void OnUsingWebRequestAPI(bool adblock, |
bool adblock_plus, |
bool other_webrequest); |
+ // UserScriptInjectionList::Observer implementation. |
+ virtual void OnUserScriptsUpdated( |
+ const std::set<std::string>& changed_extensions, |
+ const std::vector<UserScript*>& scripts) OVERRIDE; |
+ |
void UpdateActiveExtensions(); |
// Sets up the host permissions for |extension|. |
@@ -256,7 +261,7 @@ class Dispatcher : public content::RenderProcessObserver { |
scoped_ptr<ContentWatcher> content_watcher_; |
- scoped_ptr<UserScriptSlave> user_script_slave_; |
+ scoped_ptr<ScriptInjectionManager> script_injection_manager_; |
// Same as above, but on a longer timer and will run even if the process is |
// not idle, to ensure that IdleHandle gets called eventually. |
@@ -286,6 +291,11 @@ class Dispatcher : public content::RenderProcessObserver { |
// True once WebKit has been initialized (and it is therefore safe to poke). |
bool is_webkit_initialized_; |
+ // It is important for this to come after the ScriptInjectionManager, so that |
+ // the observer is destroyed before the UserScriptInjectionList. |
+ ScopedObserver<UserScriptInjectionList, UserScriptInjectionList::Observer> |
+ user_script_injection_list_observer_; |
+ |
DISALLOW_COPY_AND_ASSIGN(Dispatcher); |
}; |