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

Unified Diff: extensions/browser/browser_context_keyed_api_factory.h

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | extensions/extensions.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/browser_context_keyed_api_factory.h
diff --git a/chrome/browser/extensions/api/profile_keyed_api_factory.h b/extensions/browser/browser_context_keyed_api_factory.h
similarity index 74%
rename from chrome/browser/extensions/api/profile_keyed_api_factory.h
rename to extensions/browser/browser_context_keyed_api_factory.h
index 2a03de02c59111bc88a944cdfe16a9b5ba490bed..d74beef59d234d9a6238cf11f0128aa863eee6c7 100644
--- a/chrome/browser/extensions/api/profile_keyed_api_factory.h
+++ b/extensions/browser/browser_context_keyed_api_factory.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
-#define CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
+#ifndef EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_
+#define EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
@@ -14,19 +14,19 @@
namespace extensions {
template <typename T>
-class ProfileKeyedAPIFactory;
+class BrowserContextKeyedAPIFactory;
-// Instantiations of ProfileKeyedAPIFactory should use this base class
+// Instantiations of BrowserContextKeyedAPIFactory should use this base class
// and also define a static const char* service_name() function (used in the
// BrowserContextKeyedBaseFactory constructor). These fields should
-// be accessible to the ProfileKeyedAPIFactory for the service.
-class ProfileKeyedAPI : public BrowserContextKeyedService {
+// be accessible to the BrowserContextKeyedAPIFactory for the service.
+class BrowserContextKeyedAPI : public BrowserContextKeyedService {
protected:
- // Defaults for flags that control ProfileKeyedAPIFactory behavior.
+ // Defaults for flags that control BrowserContextKeyedAPIFactory behavior.
// These can be overridden by subclasses to change that behavior.
// See BrowserContextKeyedBaseFactory for usage.
- // These flags affect what instance is returned when GetForProfile is called
+ // These flags affect what instance is returned when Get is called
James Cook 2014/03/05 02:33:30 optional nit: I sometimes say "Get()" when referri
Yoyo Zhou 2014/03/05 02:51:30 Done.
// on an incognito profile. By default, it returns NULL. If
// kServiceRedirectedInIncognito is true, it returns the instance for the
// corresponding regular profile. If kServiceHasOwnInstanceInIncognito
@@ -36,7 +36,7 @@ class ProfileKeyedAPI : public BrowserContextKeyedService {
// If set to false, don't start the service at BrowserContext creation time.
// (The default differs from the BrowserContextKeyedBaseFactory default,
- // because historically, ProfileKeyedAPIs often do tasks at startup.)
+ // because historically, BrowserContextKeyedAPIs often do tasks at startup.)
static const bool kServiceIsCreatedWithBrowserContext = true;
// If set to true, GetForProfile returns NULL for TestingBrowserContexts.
@@ -51,15 +51,16 @@ class ProfileKeyedAPI : public BrowserContextKeyedService {
// class ProcessesAPI {
// ...
// public:
- // static ProfileKeyedAPIFactory<ProcessesAPI>* GetFactoryInstance();
+ // static BrowserContextKeyedAPIFactory<ProcessesAPI>*
+ // GetFactoryInstance();
James Cook 2014/03/05 02:33:30 nit: Indent this like real code. Or shorten the e
Yoyo Zhou 2014/03/05 02:51:30 Changed to HistoryAPI to make it short enough.
// };
//
// In the cc file, provide the implementation, e.g.:
- // static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> >
+ // static base::LazyInstance<BrowserContextKeyedAPIFactory<ProcessesAPI> >
// g_factory = LAZY_INSTANCE_INITIALIZER;
//
// // static
- // ProfileKeyedAPIFactory<ProcessesAPI>*
+ // BrowserContextKeyedAPIFactory<ProcessesAPI>*
// ProcessesAPI::GetFactoryInstance() {
// return g_factory.Pointer();
// }
@@ -70,10 +71,9 @@ class ProfileKeyedAPI : public BrowserContextKeyedService {
// template instead of its own separate factory definition to manage its
// per-profile instances.
template <typename T>
-class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
+class BrowserContextKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
public:
- // TODO(yoz): Rename to Get().
- static T* GetForProfile(content::BrowserContext* context) {
+ static T* Get(content::BrowserContext* context) {
James Cook 2014/03/05 02:33:30 Hooray!
return static_cast<T*>(
T::GetFactoryInstance()->GetServiceForBrowserContext(context, true));
}
@@ -81,26 +81,26 @@ class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
// Declare dependencies on other factories.
// By default, ExtensionSystemFactory is the only dependency; however,
// specializations can override this. Declare your specialization in
- // your header file after the ProfileKeyedAPI class definition.
+ // your header file after the BrowserContextKeyedAPI class definition.
// Then in the cc file (or inline in the header), define it, e.g.:
// template <>
- // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() {
+ // void BrowserContextKeyedAPIFactory<
James Cook 2014/03/05 02:33:30 Wow, that's an ugly line break. It's OK, but would
Yoyo Zhou 2014/03/05 02:51:30 81 characters. *tears*
+ // PushMessagingAPI>::DeclareFactoryDependencies() {
// DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
// DependsOn(ProfileSyncServiceFactory::GetInstance());
- // }
+ // }
void DeclareFactoryDependencies() {
DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
}
- ProfileKeyedAPIFactory()
+ BrowserContextKeyedAPIFactory()
: BrowserContextKeyedServiceFactory(
- T::service_name(),
- BrowserContextDependencyManager::GetInstance()) {
+ T::service_name(),
+ BrowserContextDependencyManager::GetInstance()) {
DeclareFactoryDependencies();
}
- virtual ~ProfileKeyedAPIFactory() {
- }
+ virtual ~BrowserContextKeyedAPIFactory() {}
private:
// BrowserContextKeyedServiceFactory implementation.
@@ -130,9 +130,9 @@ class ProfileKeyedAPIFactory : public BrowserContextKeyedServiceFactory {
return T::kServiceIsNULLWhileTesting;
}
- DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory);
+ DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedAPIFactory);
};
} // namespace extensions
-#endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
+#endif // EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_
« no previous file with comments | « chrome/chrome_browser_extensions.gypi ('k') | extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698