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

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

Issue 171813010: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 1). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: browser_context_ Created 6 years, 10 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/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 aba57776a15ee3d2fead37e372c6a19d3f00291d..58d76b0934931d440daf014e95eb10a5f5b70a5e 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/extensions/api/declarative_webrequest/webrequest_constants.h"
#include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h"
#include "chrome/browser/extensions/api/web_request/web_request_api.h"
+#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
@@ -40,14 +41,16 @@ bool IsWebView(const RulesRegistryService::WebViewKey& webview_key) {
} // namespace
-RulesRegistryService::RulesRegistryService(Profile* profile)
+RulesRegistryService::RulesRegistryService(content::BrowserContext* context)
: content_rules_registry_(NULL),
- profile_(profile) {
- if (profile) {
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile->GetOriginalProfile()));
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
- content::Source<Profile>(profile->GetOriginalProfile()));
+ profile_(Profile::FromBrowserContext(context)) {
+ if (profile_) {
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
+ registrar_.Add(this,
+ chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
+ content::Source<Profile>(profile_->GetOriginalProfile()));
registrar_.Add(this,
chrome::NOTIFICATION_EXTENSION_LOADED,
content::Source<Profile>(profile_->GetOriginalProfile()));
@@ -129,8 +132,9 @@ RulesRegistryService::GetFactoryInstance() {
}
// static
-RulesRegistryService* RulesRegistryService::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(profile);
+RulesRegistryService* RulesRegistryService::Get(
+ content::BrowserContext* context) {
+ return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(context);
}
void RulesRegistryService::RegisterRulesRegistry(

Powered by Google App Engine
This is Rietveld 408576698