OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ | 5 #ifndef EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ |
6 #define EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ | 6 #define EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ |
7 | 7 |
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
10 #include "components/keyed_service/core/keyed_service.h" | 10 #include "components/keyed_service/core/keyed_service.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 T::service_name(), | 96 T::service_name(), |
97 BrowserContextDependencyManager::GetInstance()) { | 97 BrowserContextDependencyManager::GetInstance()) { |
98 DeclareFactoryDependencies(); | 98 DeclareFactoryDependencies(); |
99 } | 99 } |
100 | 100 |
101 virtual ~BrowserContextKeyedAPIFactory() {} | 101 virtual ~BrowserContextKeyedAPIFactory() {} |
102 | 102 |
103 private: | 103 private: |
104 // BrowserContextKeyedServiceFactory implementation. | 104 // BrowserContextKeyedServiceFactory implementation. |
105 virtual KeyedService* BuildServiceInstanceFor( | 105 virtual KeyedService* BuildServiceInstanceFor( |
106 content::BrowserContext* context) const OVERRIDE { | 106 content::BrowserContext* context) const override { |
107 return new T(context); | 107 return new T(context); |
108 } | 108 } |
109 | 109 |
110 // BrowserContextKeyedBaseFactory implementation. | 110 // BrowserContextKeyedBaseFactory implementation. |
111 // These can be effectively overridden with template specializations. | 111 // These can be effectively overridden with template specializations. |
112 virtual content::BrowserContext* GetBrowserContextToUse( | 112 virtual content::BrowserContext* GetBrowserContextToUse( |
113 content::BrowserContext* context) const OVERRIDE { | 113 content::BrowserContext* context) const override { |
114 if (T::kServiceRedirectedInIncognito) | 114 if (T::kServiceRedirectedInIncognito) |
115 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 115 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
116 | 116 |
117 if (T::kServiceHasOwnInstanceInIncognito) | 117 if (T::kServiceHasOwnInstanceInIncognito) |
118 return context; | 118 return context; |
119 | 119 |
120 return BrowserContextKeyedServiceFactory::GetBrowserContextToUse(context); | 120 return BrowserContextKeyedServiceFactory::GetBrowserContextToUse(context); |
121 } | 121 } |
122 | 122 |
123 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE { | 123 virtual bool ServiceIsCreatedWithBrowserContext() const override { |
124 return T::kServiceIsCreatedWithBrowserContext; | 124 return T::kServiceIsCreatedWithBrowserContext; |
125 } | 125 } |
126 | 126 |
127 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE { | 127 virtual bool ServiceIsNULLWhileTesting() const override { |
128 return T::kServiceIsNULLWhileTesting; | 128 return T::kServiceIsNULLWhileTesting; |
129 } | 129 } |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedAPIFactory); | 131 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedAPIFactory); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace extensions | 134 } // namespace extensions |
135 | 135 |
136 #endif // EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ | 136 #endif // EXTENSIONS_BROWSER_BROWSER_CONTEXT_KEYED_API_FACTORY_H_ |
OLD | NEW |