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 <memory> |
| 9 |
8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
9 #include "base/callback_list.h" | 11 #include "base/callback_list.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "components/keyed_service/core/dependency_manager.h" | 12 #include "components/keyed_service/core/dependency_manager.h" |
12 #include "components/keyed_service/core/keyed_service_export.h" | 13 #include "components/keyed_service/core/keyed_service_export.h" |
13 | 14 |
14 class BrowserContextKeyedBaseFactory; | 15 class BrowserContextKeyedBaseFactory; |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 template <typename T> | 18 template <typename T> |
18 struct DefaultSingletonTraits; | 19 struct DefaultSingletonTraits; |
19 } // namespace base | 20 } // namespace base |
20 | 21 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void CreateBrowserContextServicesForTest(content::BrowserContext* context); | 56 void CreateBrowserContextServicesForTest(content::BrowserContext* context); |
56 | 57 |
57 // Called by each BrowserContext to alert us that we should destroy services | 58 // Called by each BrowserContext to alert us that we should destroy services |
58 // associated with it. | 59 // associated with it. |
59 void DestroyBrowserContextServices(content::BrowserContext* context); | 60 void DestroyBrowserContextServices(content::BrowserContext* context); |
60 | 61 |
61 // Registers a |callback| that will be called just before executing | 62 // Registers a |callback| that will be called just before executing |
62 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). | 63 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). |
63 // This can be useful in browser tests which wish to substitute test or mock | 64 // This can be useful in browser tests which wish to substitute test or mock |
64 // builders for the keyed services. | 65 // builders for the keyed services. |
65 scoped_ptr<base::CallbackList<void(content::BrowserContext*)>::Subscription> | 66 std::unique_ptr< |
| 67 base::CallbackList<void(content::BrowserContext*)>::Subscription> |
66 RegisterWillCreateBrowserContextServicesCallbackForTesting( | 68 RegisterWillCreateBrowserContextServicesCallbackForTesting( |
67 const base::Callback<void(content::BrowserContext*)>& callback); | 69 const base::Callback<void(content::BrowserContext*)>& callback); |
68 | 70 |
69 #ifndef NDEBUG | 71 #ifndef NDEBUG |
70 // Debugging assertion called as part of GetServiceForBrowserContext in debug | 72 // Debugging assertion called as part of GetServiceForBrowserContext in debug |
71 // mode. This will NOTREACHED() whenever the user is trying to access a stale | 73 // mode. This will NOTREACHED() whenever the user is trying to access a stale |
72 // BrowserContext*. | 74 // BrowserContext*. |
73 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context); | 75 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context); |
74 | 76 |
75 // Marks |context| as live (i.e., not stale). This method can be called as a | 77 // Marks |context| as live (i.e., not stale). This method can be called as a |
(...skipping 22 matching lines...) Expand all Loading... |
98 void DumpContextDependencies(base::SupportsUserData* context) const final; | 100 void DumpContextDependencies(base::SupportsUserData* context) const final; |
99 #endif // NDEBUG | 101 #endif // NDEBUG |
100 | 102 |
101 // A list of callbacks to call just before executing | 103 // A list of callbacks to call just before executing |
102 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). | 104 // CreateBrowserContextServices() or CreateBrowserContextServicesForTest(). |
103 base::CallbackList<void(content::BrowserContext*)> | 105 base::CallbackList<void(content::BrowserContext*)> |
104 will_create_browser_context_services_callbacks_; | 106 will_create_browser_context_services_callbacks_; |
105 }; | 107 }; |
106 | 108 |
107 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H
_ | 109 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_DEPENDENCY_MANAGER_H
_ |
OLD | NEW |