Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(875)

Unified Diff: chrome/browser/extensions/tab_helper.cc

Issue 344433003: Prepare declarativeContent API for new script injection feature. Added Javascript types and functio… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add description to new Javascript events Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/tab_helper.cc
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 4889d417a98dc43615753b7cb798694361462635..9651003eaa125b511eee22131ece670bed3f78f0 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -242,8 +242,15 @@ void TabHelper::DidNavigateMainFrame(
const content::FrameNavigateParams& params) {
if (ExtensionSystem::Get(profile_)->extension_service() &&
RulesRegistryService::Get(profile_)) {
- RulesRegistryService::Get(profile_)->content_rules_registry()->
- DidNavigateMainFrame(web_contents(), details, params);
+ ContentRulesRegistryMap& content_rules_registry_map =
+ RulesRegistryService::Get(profile_)->content_rules_registry_map();
+ for (ContentRulesRegistryMap::iterator it =
+ content_rules_registry_map.begin();
+ it != content_rules_registry_map.end(); ++it) {
+ it->second->DidNavigateMainFrame(web_contents(),
+ details,
+ params);
+ }
}
content::BrowserContext* context = web_contents()->GetBrowserContext();
@@ -444,11 +451,17 @@ void TabHelper::OnContentScriptsExecuting(
}
void TabHelper::OnWatchedPageChange(
+ const std::string& event_name,
const std::vector<std::string>& css_selectors) {
if (ExtensionSystem::Get(profile_)->extension_service() &&
RulesRegistryService::Get(profile_)) {
- RulesRegistryService::Get(profile_)->content_rules_registry()->Apply(
- web_contents(), css_selectors);
+ ContentRulesRegistry* content_rules_registry =
+ RulesRegistryService::Get(profile_)->
+ GetContentRulesRegistry(event_name);
+ if (!content_rules_registry)
+ return;
+
+ content_rules_registry->Apply(web_contents(), css_selectors);
}
}

Powered by Google App Engine
This is Rietveld 408576698