| Index: extensions/renderer/dispatcher.cc
|
| diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
|
| index 5870ae513eff65e655abe6b9866baaaeac53714e..0159884bd64d48b25778abdf77099c0872f75c1f 100644
|
| --- a/extensions/renderer/dispatcher.cc
|
| +++ b/extensions/renderer/dispatcher.cc
|
| @@ -36,6 +36,7 @@
|
| #include "extensions/common/permissions/permissions_data.h"
|
| #include "extensions/common/switches.h"
|
| #include "extensions/common/view_type.h"
|
| +#include "extensions/common/watched_pages_recipient.h"
|
| #include "extensions/renderer/api_activity_logger.h"
|
| #include "extensions/renderer/api_definitions_natives.h"
|
| #include "extensions/renderer/app_runtime_custom_bindings.h"
|
| @@ -174,7 +175,6 @@ class ChromeNativeHandler : public ObjectBackedNativeHandler {
|
|
|
| Dispatcher::Dispatcher(DispatcherDelegate* delegate)
|
| : delegate_(delegate),
|
| - content_watcher_(new ContentWatcher()),
|
| source_map_(&ResourceBundle::GetSharedInstance()),
|
| v8_schema_registry_(new V8SchemaRegistry),
|
| is_webkit_initialized_(false) {
|
| @@ -329,15 +329,21 @@ void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) {
|
| frame->document().insertStyleSheet(WebString::fromUTF8(stylesheet));
|
| }
|
|
|
| - content_watcher_->DidCreateDocumentElement(frame);
|
| + for (ContentWatcherMap::iterator it = content_watchers_.begin();
|
| + it != content_watchers_.end(); ++it) {
|
| + it->second->DidCreateDocumentElement(frame);
|
| + }
|
| }
|
|
|
| void Dispatcher::DidMatchCSS(
|
| blink::WebFrame* frame,
|
| const blink::WebVector<blink::WebString>& newly_matching_selectors,
|
| const blink::WebVector<blink::WebString>& stopped_matching_selectors) {
|
| - content_watcher_->DidMatchCSS(
|
| - frame, newly_matching_selectors, stopped_matching_selectors);
|
| + for (ContentWatcherMap::iterator it = content_watchers_.begin();
|
| + it != content_watchers_.end(); ++it) {
|
| + it->second->DidMatchCSS(
|
| + frame, newly_matching_selectors, stopped_matching_selectors);
|
| + }
|
| }
|
|
|
| void Dispatcher::OnExtensionResponse(int request_id,
|
| @@ -468,9 +474,8 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
|
| OnUpdateTabSpecificPermissions)
|
| IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateUserScripts, OnUpdateUserScripts)
|
| IPC_MESSAGE_HANDLER(ExtensionMsg_UsingWebRequestAPI, OnUsingWebRequestAPI)
|
| - IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages,
|
| - content_watcher_.get(),
|
| - ContentWatcher::OnWatchPages)
|
| + IPC_MESSAGE_HANDLER(ExtensionMsg_WatchPages,
|
| + OnWatchPages)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -792,6 +797,18 @@ void Dispatcher::OnUsingWebRequestAPI(bool webrequest_used) {
|
| delegate_->HandleWebRequestAPIUsage(webrequest_used);
|
| }
|
|
|
| +void Dispatcher::OnWatchPages(
|
| + const std::string& event_name,
|
| + const WatchedPagesRecipient& watched_pages_recipient,
|
| + const std::vector<std::string>& css_selectors) {
|
| + ContentWatcherMap::iterator it = content_watchers_.find(event_name);
|
| + if (it == content_watchers_.end()) {
|
| + content_watchers_[event_name] = make_linked_ptr(
|
| + new ContentWatcher(event_name, watched_pages_recipient));
|
| + }
|
| + content_watchers_[event_name]->OnWatchPages(css_selectors);
|
| +}
|
| +
|
| void Dispatcher::UpdateActiveExtensions() {
|
| std::set<std::string> active_extensions = active_extension_ids_;
|
| user_script_slave_->GetActiveExtensions(&active_extensions);
|
|
|