| Index: extensions/renderer/dispatcher.cc
|
| diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
|
| index 44b2fd0f96e818a1bf056574ab16224c2ad99ab8..cef6c94f11ab0e24be788b3b8d025d93b93323dc 100644
|
| --- a/extensions/renderer/dispatcher.cc
|
| +++ b/extensions/renderer/dispatcher.cc
|
| @@ -176,7 +176,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),
|
| @@ -339,15 +338,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,
|
| @@ -477,9 +482,8 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
|
| IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions,
|
| OnUpdateTabSpecificPermissions)
|
| 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()
|
|
|
| @@ -786,6 +790,17 @@ void Dispatcher::OnUserScriptsUpdated(
|
| UpdateActiveExtensions();
|
| }
|
|
|
| +void Dispatcher::OnWatchPages(
|
| + const std::string& event_name,
|
| + 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));
|
| + }
|
| + content_watchers_[event_name]->OnWatchPages(css_selectors);
|
| +}
|
| +
|
| void Dispatcher::UpdateActiveExtensions() {
|
| std::set<std::string> active_extensions = active_extension_ids_;
|
| user_script_set_->GetActiveExtensionIds(&active_extensions);
|
|
|