| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/history/history_service_factory.h" | 5 #include "ios/chrome/browser/history/history_service_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "components/history/core/browser/history_database_params.h" | 9 #include "components/history/core/browser/history_database_params.h" |
| 10 #include "components/history/core/browser/history_service.h" | 10 #include "components/history/core/browser/history_service.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (access_type != ServiceAccessType::EXPLICIT_ACCESS && | 43 if (access_type != ServiceAccessType::EXPLICIT_ACCESS && |
| 44 browser_state->GetPrefs()->GetBoolean( | 44 browser_state->GetPrefs()->GetBoolean( |
| 45 ios::prefs::kSavingBrowserHistoryDisabled)) { | 45 ios::prefs::kSavingBrowserHistoryDisabled)) { |
| 46 return nullptr; | 46 return nullptr; |
| 47 } | 47 } |
| 48 | 48 |
| 49 return static_cast<history::HistoryService*>( | 49 return static_cast<history::HistoryService*>( |
| 50 GetInstance()->GetServiceForBrowserState(browser_state, true)); | 50 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // static |
| 53 HistoryServiceFactory* HistoryServiceFactory::GetInstance() { | 54 HistoryServiceFactory* HistoryServiceFactory::GetInstance() { |
| 54 return Singleton<HistoryServiceFactory>::get(); | 55 return Singleton<HistoryServiceFactory>::get(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 HistoryServiceFactory::HistoryServiceFactory() | 58 HistoryServiceFactory::HistoryServiceFactory() |
| 58 : BrowserStateKeyedServiceFactory( | 59 : BrowserStateKeyedServiceFactory( |
| 59 "HistoryService", | 60 "HistoryService", |
| 60 BrowserStateDependencyManager::GetInstance()) { | 61 BrowserStateDependencyManager::GetInstance()) { |
| 61 DependsOn(GetKeyedServiceProvider()->GetBookmarkModelFactory()); | 62 DependsOn(GetKeyedServiceProvider()->GetBookmarkModelFactory()); |
| 62 } | 63 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 web::BrowserState* HistoryServiceFactory::GetBrowserStateToUse( | 87 web::BrowserState* HistoryServiceFactory::GetBrowserStateToUse( |
| 87 web::BrowserState* context) const { | 88 web::BrowserState* context) const { |
| 88 return GetBrowserStateRedirectedInIncognito(context); | 89 return GetBrowserStateRedirectedInIncognito(context); |
| 89 } | 90 } |
| 90 | 91 |
| 91 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { | 92 bool HistoryServiceFactory::ServiceIsNULLWhileTesting() const { |
| 92 return true; | 93 return true; |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace ios | 96 } // namespace ios |
| OLD | NEW |