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

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: Address first round review comments and fix test build failure 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 bc51f17378051425d25055f3f041185f4fbee937..72168bc135c333aef324aef7c419ed9a58f2b353 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -250,8 +250,15 @@ void TabHelper::DidNavigateMainFrame(
#if defined(ENABLE_EXTENSIONS)
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);
+ }
}
#endif // defined(ENABLE_EXTENSIONS)
@@ -461,12 +468,18 @@ void TabHelper::OnContentScriptsExecuting(
}
void TabHelper::OnWatchedPageChange(
+ const std::string& event_name,
const std::vector<std::string>& css_selectors) {
#if defined(ENABLE_EXTENSIONS)
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);
}
#endif // defined(ENABLE_EXTENSIONS)
}

Powered by Google App Engine
This is Rietveld 408576698