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

Side by Side Diff: chrome/browser/extensions/api/profile_keyed_api_factory.h

Issue 148083014: ExtensionSystem cleanup part 3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: mac 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
7 7
8 #include "chrome/browser/extensions/extension_system_factory.h"
9 #include "chrome/browser/profiles/incognito_helpers.h" 8 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 10 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 11 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
13 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 12 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
13 #include "extensions/browser/extension_system_provider.h"
14 #include "extensions/browser/extensions_browser_client.h"
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 template <typename T> 18 template <typename T>
18 class ProfileKeyedAPIFactory; 19 class ProfileKeyedAPIFactory;
19 20
20 // Instantiations of ProfileKeyedAPIFactory should use this base class 21 // Instantiations of ProfileKeyedAPIFactory should use this base class
21 // and also define a static const char* service_name() function (used in the 22 // and also define a static const char* service_name() function (used in the
22 // BrowserContextKeyedBaseFactory constructor). These fields should 23 // BrowserContextKeyedBaseFactory constructor). These fields should
23 // be accessible to the ProfileKeyedAPIFactory for the service. 24 // be accessible to the ProfileKeyedAPIFactory for the service.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 T::GetFactoryInstance()->GetServiceForBrowserContext(profile, true)); 66 T::GetFactoryInstance()->GetServiceForBrowserContext(profile, true));
66 } 67 }
67 68
68 // Declare dependencies on other factories. 69 // Declare dependencies on other factories.
69 // By default, ExtensionSystemFactory is the only dependency; however, 70 // By default, ExtensionSystemFactory is the only dependency; however,
70 // specializations can override this. Declare your specialization in 71 // specializations can override this. Declare your specialization in
71 // your header file after the ProfileKeyedAPI class definition. 72 // your header file after the ProfileKeyedAPI class definition.
72 // Then in the cc file (or inline in the header), define it, e.g.: 73 // Then in the cc file (or inline in the header), define it, e.g.:
73 // template <> 74 // template <>
74 // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { 75 // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() {
75 // DependsOn(ExtensionSystemFactory::GetInstance()); 76 // DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
76 // DependsOn(ProfileSyncServiceFactory::GetInstance()); 77 // DependsOn(ProfileSyncServiceFactory::GetInstance());
77 // } 78 // }
78 void DeclareFactoryDependencies() { 79 void DeclareFactoryDependencies() {
79 DependsOn(ExtensionSystemFactory::GetInstance()); 80 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
80 } 81 }
81 82
82 ProfileKeyedAPIFactory() 83 ProfileKeyedAPIFactory()
83 : BrowserContextKeyedServiceFactory( 84 : BrowserContextKeyedServiceFactory(
84 T::service_name(), 85 T::service_name(),
85 BrowserContextDependencyManager::GetInstance()) { 86 BrowserContextDependencyManager::GetInstance()) {
86 DeclareFactoryDependencies(); 87 DeclareFactoryDependencies();
87 } 88 }
88 89
89 virtual ~ProfileKeyedAPIFactory() { 90 virtual ~ProfileKeyedAPIFactory() {
(...skipping 26 matching lines...) Expand all
116 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE { 117 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE {
117 return T::kServiceIsNULLWhileTesting; 118 return T::kServiceIsNULLWhileTesting;
118 } 119 }
119 120
120 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory); 121 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory);
121 }; 122 };
122 123
123 } // namespace extensions 124 } // namespace extensions
124 125
125 #endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ 126 #endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698