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 COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H_ | 5 #ifndef COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H_ |
6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H_ | 6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H_ |
7 | 7 |
8 #include "components/keyed_service/core/keyed_service_base_factory.h" | 8 #include "components/keyed_service/core/keyed_service_base_factory.h" |
9 #include "components/keyed_service/core/keyed_service_export.h" | 9 #include "components/keyed_service/core/keyed_service_export.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // - Each BrowserContextDestroyed() is called in dependency order. We will | 83 // - Each BrowserContextDestroyed() is called in dependency order. We will |
84 // NOTREACHED() if you attempt to GetForBrowserContext() any other service. | 84 // NOTREACHED() if you attempt to GetForBrowserContext() any other service. |
85 // You should delete/deref/do other final memory management things during | 85 // You should delete/deref/do other final memory management things during |
86 // this phase. You must also call the base class method as the last thing | 86 // this phase. You must also call the base class method as the last thing |
87 // you do. | 87 // you do. |
88 virtual void BrowserContextShutdown(content::BrowserContext* context) = 0; | 88 virtual void BrowserContextShutdown(content::BrowserContext* context) = 0; |
89 virtual void BrowserContextDestroyed(content::BrowserContext* context); | 89 virtual void BrowserContextDestroyed(content::BrowserContext* context); |
90 | 90 |
91 private: | 91 private: |
92 // Registers any user preferences on this service. This is called by | 92 // Registers any user preferences on this service. This is called by |
93 // RegisterProfilePrefsIfNecessary() and should be overriden by any service | 93 // RegisterPrefsIfNecessaryForContext() and should be overriden by any service |
94 // that wants to register profile-specific preferences. | 94 // that wants to register profile-specific preferences. |
95 virtual void RegisterProfilePrefs( | 95 virtual void RegisterProfilePrefs( |
96 user_prefs::PrefRegistrySyncable* registry) {} | 96 user_prefs::PrefRegistrySyncable* registry) {} |
97 | 97 |
98 // Because of ServiceIsNULLWhileTesting(), we need a way to tell different | 98 // Because of ServiceIsNULLWhileTesting(), we need a way to tell different |
99 // subclasses that they should disable testing. | 99 // subclasses that they should disable testing. |
100 virtual void SetEmptyTestingFactory(content::BrowserContext* context) = 0; | 100 virtual void SetEmptyTestingFactory(content::BrowserContext* context) = 0; |
101 | 101 |
102 // Returns true if a testing factory function has been set for |context|. | 102 // Returns true if a testing factory function has been set for |context|. |
103 virtual bool HasTestingFactory(content::BrowserContext* context) = 0; | 103 virtual bool HasTestingFactory(content::BrowserContext* context) = 0; |
104 | 104 |
105 // We also need a generalized, non-returning method that generates the object | 105 // We also need a generalized, non-returning method that generates the object |
106 // now for when we're creating the context. | 106 // now for when we're creating the context. |
107 virtual void CreateServiceNow(content::BrowserContext* context) = 0; | 107 virtual void CreateServiceNow(content::BrowserContext* context) = 0; |
108 | 108 |
109 // KeyedServiceBaseFactory: | 109 // KeyedServiceBaseFactory: |
110 user_prefs::PrefRegistrySyncable* GetAssociatedPrefRegistry( | |
111 base::SupportsUserData* context) const final; | |
112 base::SupportsUserData* GetContextToUse( | 110 base::SupportsUserData* GetContextToUse( |
113 base::SupportsUserData* context) const final; | 111 base::SupportsUserData* context) const final; |
114 bool ServiceIsCreatedWithContext() const final; | 112 bool ServiceIsCreatedWithContext() const final; |
115 void ContextShutdown(base::SupportsUserData* context) final; | 113 void ContextShutdown(base::SupportsUserData* context) final; |
116 void ContextDestroyed(base::SupportsUserData* context) final; | 114 void ContextDestroyed(base::SupportsUserData* context) final; |
117 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) final; | 115 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) final; |
118 void SetEmptyTestingFactory(base::SupportsUserData* context) final; | 116 void SetEmptyTestingFactory(base::SupportsUserData* context) final; |
119 bool HasTestingFactory(base::SupportsUserData* context) final; | 117 bool HasTestingFactory(base::SupportsUserData* context) final; |
120 void CreateServiceNow(base::SupportsUserData* context) final; | 118 void CreateServiceNow(base::SupportsUserData* context) final; |
121 }; | 119 }; |
122 | 120 |
123 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H
_ | 121 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_BASE_FACTORY_H
_ |
OLD | NEW |