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_DEPENDENCY_MANAGER_H_ | 5 #ifndef COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H_ |
6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H_ | 6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/callback_list.h" | 9 #include "base/callback_list.h" |
10 #include "components/keyed_service/core/dependency_manager.h" | 10 #include "components/keyed_service/core/dependency_manager.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order | 26 // rebroadcasts them to each BrowserContextKeyedBaseFactory in a safe order |
27 // based on the stated dependencies by each service. | 27 // based on the stated dependencies by each service. |
28 class KEYED_SERVICE_EXPORT BrowserContextDependencyManager | 28 class KEYED_SERVICE_EXPORT BrowserContextDependencyManager |
29 : public DependencyManager { | 29 : public DependencyManager { |
30 public: | 30 public: |
31 // Registers profile-specific preferences for all services via |registry|. | 31 // Registers profile-specific preferences for all services via |registry|. |
32 // |context| should be the BrowserContext containing |registry| and is used as | 32 // |context| should be the BrowserContext containing |registry| and is used as |
33 // a key to prevent multiple registrations on the same BrowserContext in | 33 // a key to prevent multiple registrations on the same BrowserContext in |
34 // tests. | 34 // tests. |
35 void RegisterProfilePrefsForServices( | 35 void RegisterProfilePrefsForServices( |
36 const content::BrowserContext* context, | 36 content::BrowserContext* context, |
37 user_prefs::PrefRegistrySyncable* registry); | 37 user_prefs::PrefRegistrySyncable* registry); |
38 | 38 |
39 // Called by each BrowserContext to alert us of its creation. Several | 39 // Called by each BrowserContext to alert us of its creation. Several |
40 // services want to be started when a context is created. If you want your | 40 // services want to be started when a context is created. If you want your |
41 // KeyedService to be started with the BrowserContext, override | 41 // KeyedService to be started with the BrowserContext, override |
42 // BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() to | 42 // BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() to |
43 // return true. This method also registers any service-related preferences | 43 // return true. This method also registers any service-related preferences |
44 // for non-incognito profiles. | 44 // for non-incognito profiles. |
45 void CreateBrowserContextServices(content::BrowserContext* context); | 45 void CreateBrowserContextServices(content::BrowserContext* context); |
46 | 46 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Helper function used by CreateBrowserContextServices[ForTest]. | 85 // Helper function used by CreateBrowserContextServices[ForTest]. |
86 void DoCreateBrowserContextServices(content::BrowserContext* context, | 86 void DoCreateBrowserContextServices(content::BrowserContext* context, |
87 bool is_testing_context); | 87 bool is_testing_context); |
88 | 88 |
89 BrowserContextDependencyManager(); | 89 BrowserContextDependencyManager(); |
90 ~BrowserContextDependencyManager() override; | 90 ~BrowserContextDependencyManager() override; |
91 | 91 |
92 #ifndef NDEBUG | 92 #ifndef NDEBUG |
93 // DependencyManager: | 93 // DependencyManager: |
94 void DumpContextDependencies( | 94 void DumpContextDependencies(base::SupportsUserData* context) const final; |
95 const base::SupportsUserData* context) const final; | |
96 #endif // NDEBUG | 95 #endif // NDEBUG |
97 | 96 |
98 // A list of callbacks to call just before executing | 97 // A list of callbacks to call just before executing |
99 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). | 98 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). |
100 base::CallbackList<void(content::BrowserContext*)> | 99 base::CallbackList<void(content::BrowserContext*)> |
101 will_create_browser_context_services_callbacks_; | 100 will_create_browser_context_services_callbacks_; |
102 }; | 101 }; |
103 | 102 |
104 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H
_ | 103 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H
_ |
OLD | NEW |