| 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/browser_state_keyed_service_factory.h" | 5 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "components/keyed_service/core/keyed_service.h" | 8 #include "components/keyed_service/core/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 "ios/web/public/browser_state.h" | 10 #include "ios/web/public/browser_state.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 KeyedService* BrowserStateKeyedServiceFactory::GetServiceForBrowserState( | 37 KeyedService* BrowserStateKeyedServiceFactory::GetServiceForBrowserState( |
| 38 web::BrowserState* context, | 38 web::BrowserState* context, |
| 39 bool create) { | 39 bool create) { |
| 40 return KeyedServiceFactory::GetServiceForContext(context, create); | 40 return KeyedServiceFactory::GetServiceForContext(context, create); |
| 41 } | 41 } |
| 42 | 42 |
| 43 web::BrowserState* BrowserStateKeyedServiceFactory::GetBrowserStateToUse( | 43 web::BrowserState* BrowserStateKeyedServiceFactory::GetBrowserStateToUse( |
| 44 web::BrowserState* context) const { | 44 web::BrowserState* context) const { |
| 45 // TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse(). | 45 // TODO(crbug.com/701326): This DCHECK should be moved to GetContextToUse(). |
| 46 DCHECK(CalledOnValidThread()); | 46 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 47 | 47 |
| 48 // Safe default for Incognito mode: no service. | 48 // Safe default for Incognito mode: no service. |
| 49 if (context->IsOffTheRecord()) | 49 if (context->IsOffTheRecord()) |
| 50 return nullptr; | 50 return nullptr; |
| 51 | 51 |
| 52 return context; | 52 return context; |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithBrowserState() const { | 55 bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithBrowserState() const { |
| 56 return KeyedServiceBaseFactory::ServiceIsCreatedWithContext(); | 56 return KeyedServiceBaseFactory::ServiceIsCreatedWithContext(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 void BrowserStateKeyedServiceFactory::ContextDestroyed( | 99 void BrowserStateKeyedServiceFactory::ContextDestroyed( |
| 100 base::SupportsUserData* context) { | 100 base::SupportsUserData* context) { |
| 101 BrowserStateDestroyed(static_cast<web::BrowserState*>(context)); | 101 BrowserStateDestroyed(static_cast<web::BrowserState*>(context)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void BrowserStateKeyedServiceFactory::RegisterPrefs( | 104 void BrowserStateKeyedServiceFactory::RegisterPrefs( |
| 105 user_prefs::PrefRegistrySyncable* registry) { | 105 user_prefs::PrefRegistrySyncable* registry) { |
| 106 RegisterBrowserStatePrefs(registry); | 106 RegisterBrowserStatePrefs(registry); |
| 107 } | 107 } |
| OLD | NEW |