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

Unified Diff: chrome/browser/extensions/api/profile_keyed_api_factory.h

Issue 179243002: Change ProfileKeyedAPIFactory to build instances with BrowserContext instead of Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: locationbarview 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/profile_keyed_api_factory.h
diff --git a/chrome/browser/extensions/api/profile_keyed_api_factory.h b/chrome/browser/extensions/api/profile_keyed_api_factory.h
index 83f0d8c9a59590876e5441a0b55d6e2e3524a22f..6701e68f81578434bd399b780da5bc352dfa688c 100644
--- a/chrome/browser/extensions/api/profile_keyed_api_factory.h
+++ b/chrome/browser/extensions/api/profile_keyed_api_factory.h
@@ -5,8 +5,6 @@
#ifndef CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
#define CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
-#include "chrome/browser/profiles/incognito_helpers.h"
-#include "chrome/browser/profiles/profile.h"
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
@@ -61,15 +59,10 @@ class ProfileKeyedAPI : public BrowserContextKeyedService {
template <typename T>
class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
public:
- // TODO(yoz): Delete this one.
- static T* GetForProfile(Profile* profile) {
- return static_cast<T*>(
- T::GetFactoryInstance()->GetServiceForBrowserContext(profile, true));
- }
-
+ // TODO(yoz): Rename to Get().
static T* GetForProfile(content::BrowserContext* context) {
- return static_cast<T*>(T::GetFactoryInstance()->GetServiceForBrowserContext(
- Profile::FromBrowserContext(context), true));
+ return static_cast<T*>(
+ T::GetFactoryInstance()->GetServiceForBrowserContext(context, true));
}
// Declare dependencies on other factories.
@@ -99,8 +92,8 @@ class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
private:
// BrowserContextKeyedServiceFactory implementation.
virtual BrowserContextKeyedService* BuildServiceInstanceFor(
- content::BrowserContext* profile) const OVERRIDE {
- return new T(static_cast<Profile*>(profile));
+ content::BrowserContext* context) const OVERRIDE {
+ return new T(context);
}
// BrowserContextKeyedBaseFactory implementation.
@@ -108,10 +101,10 @@ class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
virtual content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const OVERRIDE {
if (T::kServiceRedirectedInIncognito)
- return chrome::GetBrowserContextRedirectedInIncognito(context);
+ return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
if (T::kServiceHasOwnInstanceInIncognito)
- return chrome::GetBrowserContextOwnInstanceInIncognito(context);
+ return context;
return BrowserContextKeyedServiceFactory::GetBrowserContextToUse(context);
}
« no previous file with comments | « chrome/browser/extensions/api/processes/processes_api.cc ('k') | chrome/browser/extensions/api/serial/serial_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698