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 COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_FACT
ORY_H_ | 5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_FACT
ORY_H_ |
6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_FACT
ORY_H_ | 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_FACT
ORY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // you do. | 104 // you do. |
105 virtual void BrowserContextShutdown(content::BrowserContext* context) = 0; | 105 virtual void BrowserContextShutdown(content::BrowserContext* context) = 0; |
106 virtual void BrowserContextDestroyed(content::BrowserContext* context); | 106 virtual void BrowserContextDestroyed(content::BrowserContext* context); |
107 | 107 |
108 // Returns whether we've registered the preferences on this context. | 108 // Returns whether we've registered the preferences on this context. |
109 bool ArePreferencesSetOn(content::BrowserContext* context) const; | 109 bool ArePreferencesSetOn(content::BrowserContext* context) const; |
110 | 110 |
111 // Mark context as Preferences set. | 111 // Mark context as Preferences set. |
112 void MarkPreferencesSetOn(content::BrowserContext* context); | 112 void MarkPreferencesSetOn(content::BrowserContext* context); |
113 | 113 |
| 114 // Which BrowserContextDependencyManager we should communicate with. |
| 115 // In real code, this will always be |
| 116 // BrowserContextDependencyManager::GetInstance(), but unit tests will want |
| 117 // to use their own copy. |
| 118 BrowserContextDependencyManager* dependency_manager_; |
| 119 |
114 private: | 120 private: |
115 friend class BrowserContextDependencyManager; | 121 friend class BrowserContextDependencyManager; |
116 friend class BrowserContextDependencyManagerUnittests; | 122 friend class BrowserContextDependencyManagerUnittests; |
117 | 123 |
118 // Registers any user preferences on this service. This is called by | 124 // Registers any user preferences on this service. This is called by |
119 // RegisterProfilePrefsIfNecessary() and should be overriden by any service | 125 // RegisterProfilePrefsIfNecessary() and should be overriden by any service |
120 // that wants to register profile-specific preferences. | 126 // that wants to register profile-specific preferences. |
121 virtual void RegisterProfilePrefs( | 127 virtual void RegisterProfilePrefs( |
122 user_prefs::PrefRegistrySyncable* registry) {} | 128 user_prefs::PrefRegistrySyncable* registry) {} |
123 | 129 |
124 // These two methods are for tight integration with the | 130 // These two methods are for tight integration with the |
125 // BrowserContextDependencyManager. | 131 // BrowserContextDependencyManager. |
126 | 132 |
127 // Because of ServiceIsNULLWhileTesting(), we need a way to tell different | 133 // Because of ServiceIsNULLWhileTesting(), we need a way to tell different |
128 // subclasses that they should disable testing. | 134 // subclasses that they should disable testing. |
129 virtual void SetEmptyTestingFactory(content::BrowserContext* context) = 0; | 135 virtual void SetEmptyTestingFactory(content::BrowserContext* context) = 0; |
130 | 136 |
131 // We also need a generalized, non-returning method that generates the object | 137 // We also need a generalized, non-returning method that generates the object |
132 // now for when we're creating the context. | 138 // now for when we're creating the context. |
133 virtual void CreateServiceNow(content::BrowserContext* context) = 0; | 139 virtual void CreateServiceNow(content::BrowserContext* context) = 0; |
134 | 140 |
135 // Which BrowserContextDependencyManager we should communicate with. | |
136 // In real code, this will always be | |
137 // BrowserContextDependencyManager::GetInstance(), but unit tests will want | |
138 // to use their own copy. | |
139 BrowserContextDependencyManager* dependency_manager_; | |
140 | |
141 // BrowserContexts that have this service's preferences registered on them. | 141 // BrowserContexts that have this service's preferences registered on them. |
142 std::set<const content::BrowserContext*> registered_preferences_; | 142 std::set<const content::BrowserContext*> registered_preferences_; |
143 | 143 |
144 #if !defined(NDEBUG) | 144 #if !defined(NDEBUG) |
145 // A static string passed in to our constructor. Should be unique across all | 145 // A static string passed in to our constructor. Should be unique across all |
146 // services. This is used only for debugging in debug mode. (We can print | 146 // services. This is used only for debugging in debug mode. (We can print |
147 // pretty graphs with GraphViz with this information.) | 147 // pretty graphs with GraphViz with this information.) |
148 const char* service_name_; | 148 const char* service_name_; |
149 #endif | 149 #endif |
150 }; | 150 }; |
151 | 151 |
152 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_F
ACTORY_H_ | 152 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_F
ACTORY_H_ |
OLD | NEW |