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

Unified Diff: chrome/browser/extensions/api/declarative/rules_registry_service.cc

Issue 10831008: Refactor and fix declarative webRequest API permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed license headers Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/declarative/rules_registry_service.cc
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.cc b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
index aead2a977fc688213a2a0fee607abecc26e9dd93..24e7f3259200d11c542f30032d5c724149255236 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
@@ -22,15 +22,20 @@ namespace extensions {
namespace {
// Returns the key to use for storing declarative rules in the state store.
-std::string GetDeclarativeRuleStorageKey(const std::string& event_name) {
- return "declarative_rules." + event_name;
+std::string GetDeclarativeRuleStorageKey(const std::string& event_name,
+ bool incognito) {
+ if (incognito)
+ return "declarative_rules.incognito." + event_name;
+ else
+ return "declarative_rules." + event_name;
}
// Registers |web_request_rules_registry| on the IO thread.
void RegisterToExtensionWebRequestEventRouterOnIO(
+ void* profile,
scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry) {
ExtensionWebRequestEventRouter::GetInstance()->RegisterRulesRegistry(
- web_request_rules_registry);
+ profile, web_request_rules_registry);
}
} // namespace
@@ -39,7 +44,7 @@ RulesRegistryService::RulesRegistryService(Profile* profile)
: profile_(profile) {
if (profile) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile));
+ content::Source<Profile>(profile->GetOriginalProfile()));
}
}
@@ -54,7 +59,8 @@ void RulesRegistryService::RegisterDefaultRulesRegistries() {
new WebRequestRulesRegistry(profile_, delegate));
delegate->InitOnUIThread(profile_, web_request_rules_registry,
GetDeclarativeRuleStorageKey(
- declarative_webrequest_constants::kOnRequest));
+ declarative_webrequest_constants::kOnRequest,
+ profile_->IsOffTheRecord()));
delegates_.push_back(delegate);
RegisterRulesRegistry(declarative_webrequest_constants::kOnRequest,
@@ -62,14 +68,14 @@ void RulesRegistryService::RegisterDefaultRulesRegistries() {
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
- web_request_rules_registry));
+ profile_, web_request_rules_registry));
}
void RulesRegistryService::Shutdown() {
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
- scoped_refptr<WebRequestRulesRegistry>(NULL)));
+ profile_, scoped_refptr<WebRequestRulesRegistry>(NULL)));
}
void RulesRegistryService::RegisterRulesRegistry(
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative/rules_registry_storage_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698