| 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" |
| 11 #include "components/browser_context_keyed_service/browser_context_keyed_service
_export.h" |
| 11 #include "components/browser_context_keyed_service/dependency_node.h" | 12 #include "components/browser_context_keyed_service/dependency_node.h" |
| 12 | 13 |
| 13 class BrowserContextDependencyManager; | 14 class BrowserContextDependencyManager; |
| 14 class PrefService; | 15 class PrefService; |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 class BrowserContext; | 18 class BrowserContext; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace user_prefs { | 21 namespace user_prefs { |
| 21 class PrefRegistrySyncable; | 22 class PrefRegistrySyncable; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // Base class for Factories that take a BrowserContext object and return some | 25 // Base class for Factories that take a BrowserContext object and return some |
| 25 // service. | 26 // service. |
| 26 // | 27 // |
| 27 // Unless you're trying to make a new type of Factory, you probably don't want | 28 // Unless you're trying to make a new type of Factory, you probably don't want |
| 28 // this class, but its subclasses: BrowserContextKeyedServiceFactory and | 29 // this class, but its subclasses: BrowserContextKeyedServiceFactory and |
| 29 // RefcountedBrowserContextKeyedServiceFactory. This object describes general | 30 // RefcountedBrowserContextKeyedServiceFactory. This object describes general |
| 30 // dependency management between Factories; subclasses react to lifecycle | 31 // dependency management between Factories; subclasses react to lifecycle |
| 31 // events and implement memory management. | 32 // events and implement memory management. |
| 32 class BrowserContextKeyedBaseFactory : public base::NonThreadSafe, | 33 class BROWSER_CONTEXT_KEYED_SERVICE_EXPORT |
| 33 public DependencyNode { | 34 BrowserContextKeyedBaseFactory |
| 35 : public base::NonThreadSafe, |
| 36 NON_EXPORTED_BASE(public DependencyNode) { |
| 34 public: | 37 public: |
| 35 // Registers preferences used in this service on the pref service of | 38 // Registers preferences used in this service on the pref service of |
| 36 // |context|. This is the public interface and is safe to be called multiple | 39 // |context|. This is the public interface and is safe to be called multiple |
| 37 // times because testing code can have multiple services of the same type | 40 // times because testing code can have multiple services of the same type |
| 38 // attached to a single |context|. | 41 // attached to a single |context|. |
| 39 void RegisterUserPrefsOnBrowserContext(content::BrowserContext* context); | 42 void RegisterUserPrefsOnBrowserContext(content::BrowserContext* context); |
| 40 | 43 |
| 41 #ifndef NDEBUG | 44 #ifndef NDEBUG |
| 42 // Returns our name. We don't keep track of this in release mode. | 45 // Returns our name. We don't keep track of this in release mode. |
| 43 const char* name() const { return service_name_; } | 46 const char* name() const { return service_name_; } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 130 |
| 128 #if !defined(NDEBUG) | 131 #if !defined(NDEBUG) |
| 129 // A static string passed in to our constructor. Should be unique across all | 132 // A static string passed in to our constructor. Should be unique across all |
| 130 // services. This is used only for debugging in debug mode. (We can print | 133 // services. This is used only for debugging in debug mode. (We can print |
| 131 // pretty graphs with GraphViz with this information.) | 134 // pretty graphs with GraphViz with this information.) |
| 132 const char* service_name_; | 135 const char* service_name_; |
| 133 #endif | 136 #endif |
| 134 }; | 137 }; |
| 135 | 138 |
| 136 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_F
ACTORY_H_ | 139 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_KEYED_BASE_F
ACTORY_H_ |
| OLD | NEW |