| 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 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" | 5 #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_fa
ctory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/keyed_service/core/refcounted_keyed_service.h" | 8 #include "components/keyed_service/core/refcounted_keyed_service.h" |
| 9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| 10 #include "components/keyed_service/ios/browser_state_helper.h" | 10 #include "components/keyed_service/ios/browser_state_helper.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void RefcountedBrowserStateKeyedServiceFactory::BrowserStateDestroyed( | 81 void RefcountedBrowserStateKeyedServiceFactory::BrowserStateDestroyed( |
| 82 web::BrowserState* context) { | 82 web::BrowserState* context) { |
| 83 RefcountedKeyedServiceFactory::ContextDestroyed(context); | 83 RefcountedKeyedServiceFactory::ContextDestroyed(context); |
| 84 } | 84 } |
| 85 | 85 |
| 86 scoped_refptr<RefcountedKeyedService> | 86 scoped_refptr<RefcountedKeyedService> |
| 87 RefcountedBrowserStateKeyedServiceFactory::BuildServiceInstanceFor( | 87 RefcountedBrowserStateKeyedServiceFactory::BuildServiceInstanceFor( |
| 88 base::SupportsUserData* context) const { | 88 base::SupportsUserData* context) const { |
| 89 return BuildServiceInstanceFor(BrowserStateFromContext(context)); | 89 return BuildServiceInstanceFor(UnderlyingContextFromContext(context)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool RefcountedBrowserStateKeyedServiceFactory::IsOffTheRecord( | 92 bool RefcountedBrowserStateKeyedServiceFactory::IsOffTheRecord( |
| 93 base::SupportsUserData* context) const { | 93 base::SupportsUserData* context) const { |
| 94 return BrowserStateFromContext(context)->IsOffTheRecord(); | 94 return UnderlyingContextFromContext(context)->IsOffTheRecord(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 user_prefs::PrefRegistrySyncable* | 97 base::SupportsUserData* |
| 98 RefcountedBrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry( | 98 RefcountedBrowserStateKeyedServiceFactory::GetUnderlyingContextInternal( |
| 99 base::SupportsUserData* context) const { | 99 base::SupportsUserData* context) const { |
| 100 NOTREACHED(); | 100 return UnderlyingContextFromContext(context); |
| 101 return nullptr; | 101 } |
| 102 |
| 103 base::SupportsUserData* |
| 104 RefcountedBrowserStateKeyedServiceFactory::GetOriginalContextInternal( |
| 105 base::SupportsUserData* context) const { |
| 106 return OriginalContextFromContext(context); |
| 102 } | 107 } |
| 103 | 108 |
| 104 base::SupportsUserData* | 109 base::SupportsUserData* |
| 105 RefcountedBrowserStateKeyedServiceFactory::GetContextToUse( | 110 RefcountedBrowserStateKeyedServiceFactory::GetContextToUse( |
| 106 base::SupportsUserData* context) const { | 111 base::SupportsUserData* context) const { |
| 107 return GetBrowserStateToUse(BrowserStateFromContext(context)); | 112 return GetBrowserStateToUse(UnderlyingContextFromContext(context)); |
| 108 } | 113 } |
| 109 | 114 |
| 110 bool RefcountedBrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() | 115 bool RefcountedBrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() |
| 111 const { | 116 const { |
| 112 return ServiceIsCreatedWithBrowserState(); | 117 return ServiceIsCreatedWithBrowserState(); |
| 113 } | 118 } |
| 114 | 119 |
| 115 void RefcountedBrowserStateKeyedServiceFactory::ContextShutdown( | 120 void RefcountedBrowserStateKeyedServiceFactory::ContextShutdown( |
| 116 base::SupportsUserData* context) { | 121 base::SupportsUserData* context) { |
| 117 BrowserStateShutdown(BrowserStateFromContext(context)); | 122 BrowserStateShutdown(UnderlyingContextFromContext(context)); |
| 118 } | 123 } |
| 119 | 124 |
| 120 void RefcountedBrowserStateKeyedServiceFactory::ContextDestroyed( | 125 void RefcountedBrowserStateKeyedServiceFactory::ContextDestroyed( |
| 121 base::SupportsUserData* context) { | 126 base::SupportsUserData* context) { |
| 122 BrowserStateDestroyed(BrowserStateFromContext(context)); | 127 BrowserStateDestroyed(UnderlyingContextFromContext(context)); |
| 123 } | 128 } |
| 124 | 129 |
| 125 void RefcountedBrowserStateKeyedServiceFactory::RegisterPrefs( | 130 void RefcountedBrowserStateKeyedServiceFactory::RegisterPrefs( |
| 126 user_prefs::PrefRegistrySyncable* registry) { | 131 user_prefs::PrefRegistrySyncable* registry) { |
| 127 RegisterProfilePrefs(registry); | 132 RegisterBrowserStatePrefs(registry); |
| 128 } | 133 } |
| OLD | NEW |