OLD | NEW |
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" | 8 #include "chrome/browser/extensions/extension_system_factory.h" |
9 #include "chrome/browser/profiles/profile_dependency_manager.h" | 9 #include "chrome/browser/profiles/profile_dependency_manager.h" |
10 #include "chrome/browser/profiles/profile_keyed_service.h" | 10 #include "chrome/browser/profiles/profile_keyed_service.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // | 47 // |
48 // In the cc file, provide the implementation: | 48 // In the cc file, provide the implementation: |
49 // static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> > | 49 // static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> > |
50 // g_factory = LAZY_INSTANCE_INITIALIZER; | 50 // g_factory = LAZY_INSTANCE_INITIALIZER; |
51 // | 51 // |
52 // template <> | 52 // template <> |
53 // ProfileKeyedAPIFactory<ProcessesAPI>* | 53 // ProfileKeyedAPIFactory<ProcessesAPI>* |
54 // ProfileKeyedAPIFactory<ProcessesAPI>::GetInstance() { | 54 // ProfileKeyedAPIFactory<ProcessesAPI>::GetInstance() { |
55 // return &g_factory.Get(); | 55 // return &g_factory.Get(); |
56 // } | 56 // } |
57 | |
58 static ProfileKeyedAPIFactory* GetInstance(); | 57 static ProfileKeyedAPIFactory* GetInstance(); |
59 | 58 |
60 // Declare dependencies on other factories. | 59 // Declare dependencies on other factories. |
61 // By default, ExtensionSystemFactory is the only dependency; however, | 60 // By default, ExtensionSystemFactory is the only dependency; however, |
62 // specializations can override this. Declare your specialization in | 61 // specializations can override this. Declare your specialization in |
63 // your header file after the ProfileKeyedAPI class definition. | 62 // your header file after the ProfileKeyedAPI class definition. |
64 // Then in the cc file (or inline in the header), define it, e.g.: | 63 // Then in the cc file (or inline in the header), define it, e.g.: |
65 // template <> | 64 // template <> |
66 // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { | 65 // ProfileKeyedAPIFactory<PushMessagingAPI>::DeclareFactoryDependencies() { |
67 // DependsOn(ExtensionSystemFactory::GetInstance()); | 66 // DependsOn(ExtensionSystemFactory::GetInstance()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE { | 99 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE { |
101 return T::kServiceIsNULLWhileTesting; | 100 return T::kServiceIsNULLWhileTesting; |
102 } | 101 } |
103 | 102 |
104 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory); | 103 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedAPIFactory); |
105 }; | 104 }; |
106 | 105 |
107 } // namespace extensions | 106 } // namespace extensions |
108 | 107 |
109 #endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ | 108 #endif // CHROME_BROWSER_EXTENSIONS_API_PROFILE_KEYED_API_FACTORY_H_ |
OLD | NEW |