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_IOS_BROWSER_STATE_DEPENDENCY_MANAGER_H_ | 5 #ifndef COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_DEPENDENCY_MANAGER_H_ |
6 #define COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_DEPENDENCY_MANAGER_H_ | 6 #define COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_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 "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // based on the stated dependencies by each service. | 27 // based on the stated dependencies by each service. |
28 class KEYED_SERVICE_EXPORT BrowserStateDependencyManager | 28 class KEYED_SERVICE_EXPORT BrowserStateDependencyManager |
29 : public DependencyManager { | 29 : public DependencyManager { |
30 public: | 30 public: |
31 static BrowserStateDependencyManager* GetInstance(); | 31 static BrowserStateDependencyManager* GetInstance(); |
32 | 32 |
33 // Registers context-specific preferences for all services via |registry|. | 33 // Registers context-specific preferences for all services via |registry|. |
34 // |context| should be the BrowserState containing |registry| and is used as | 34 // |context| should be the BrowserState containing |registry| and is used as |
35 // a key to prevent multiple registrations on the same BrowserState in | 35 // a key to prevent multiple registrations on the same BrowserState in |
36 // tests. | 36 // tests. |
37 void RegisterProfilePrefsForServices( | 37 void RegisterBrowserStatePrefsForServices( |
38 const web::BrowserState* context, | 38 web::BrowserState* context, |
39 user_prefs::PrefRegistrySyncable* registry); | 39 user_prefs::PrefRegistrySyncable* registry); |
40 | 40 |
41 // Called by each BrowserState to alert us of its creation. Service that | 41 // Called by each BrowserState to alert us of its creation. Service that |
42 // want to be started when BrowserState is created should override the | 42 // want to be started when BrowserState is created should override the |
43 // ServiceIsCreatedWithBrowserState() method in their factory. Preferences | 43 // ServiceIsCreatedWithBrowserState() method in their factory. Preferences |
44 // registration also happens during that method call. | 44 // registration also happens during that method call. |
45 void CreateBrowserStateServices(web::BrowserState* context); | 45 void CreateBrowserStateServices(web::BrowserState* context); |
46 | 46 |
47 // Similar to CreateBrowserStateServices(), except this is used for creating | 47 // Similar to CreateBrowserStateServices(), except this is used for creating |
48 // test BrowserStates - these contexts will not create services for any | 48 // test BrowserStates - these contexts will not create services for any |
(...skipping 24 matching lines...) Expand all Loading... |
73 | 73 |
74 BrowserStateDependencyManager(); | 74 BrowserStateDependencyManager(); |
75 ~BrowserStateDependencyManager() override; | 75 ~BrowserStateDependencyManager() override; |
76 | 76 |
77 // Helper function used by CreateBrowserStateServices[ForTest]. | 77 // Helper function used by CreateBrowserStateServices[ForTest]. |
78 void DoCreateBrowserStateServices(web::BrowserState* context, | 78 void DoCreateBrowserStateServices(web::BrowserState* context, |
79 bool is_testing_context); | 79 bool is_testing_context); |
80 | 80 |
81 #ifndef NDEBUG | 81 #ifndef NDEBUG |
82 // DependencyManager: | 82 // DependencyManager: |
83 void DumpContextDependencies( | 83 void DumpContextDependencies(base::SupportsUserData* context) const final; |
84 const base::SupportsUserData* context) const final; | |
85 #endif // NDEBUG | 84 #endif // NDEBUG |
86 | 85 |
87 DISALLOW_COPY_AND_ASSIGN(BrowserStateDependencyManager); | 86 DISALLOW_COPY_AND_ASSIGN(BrowserStateDependencyManager); |
88 }; | 87 }; |
89 | 88 |
90 #endif // COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_DEPENDENCY_MANAGER_H_ | 89 #endif // COMPONENTS_KEYED_SERVICE_IOS_BROWSER_STATE_DEPENDENCY_MANAGER_H_ |
OLD | NEW |