| 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/web_data_service_factory.h" | 5 #include "ios/chrome/browser/web_data_service_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 11 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 12 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 12 #include "components/keyed_service/core/service_access_type.h" | 13 #include "components/keyed_service/core/service_access_type.h" |
| 13 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 14 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| 14 #include "components/search_engines/keyword_web_data_service.h" | 15 #include "components/search_engines/keyword_web_data_service.h" |
| 15 #include "components/signin/core/browser/webdata/token_web_data.h" | 16 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 16 #include "components/webdata_services/web_data_service_wrapper.h" | 17 #include "components/webdata_services/web_data_service_wrapper.h" |
| 17 #include "ios/chrome/browser/application_context.h" | 18 #include "ios/chrome/browser/application_context.h" |
| 18 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" | 19 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" |
| 19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 20 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 87 |
| 87 WebDataServiceFactory::WebDataServiceFactory() | 88 WebDataServiceFactory::WebDataServiceFactory() |
| 88 : BrowserStateKeyedServiceFactory( | 89 : BrowserStateKeyedServiceFactory( |
| 89 "WebDataService", | 90 "WebDataService", |
| 90 BrowserStateDependencyManager::GetInstance()) { | 91 BrowserStateDependencyManager::GetInstance()) { |
| 91 } | 92 } |
| 92 | 93 |
| 93 WebDataServiceFactory::~WebDataServiceFactory() { | 94 WebDataServiceFactory::~WebDataServiceFactory() { |
| 94 } | 95 } |
| 95 | 96 |
| 96 scoped_ptr<KeyedService> WebDataServiceFactory::BuildServiceInstanceFor( | 97 std::unique_ptr<KeyedService> WebDataServiceFactory::BuildServiceInstanceFor( |
| 97 web::BrowserState* context) const { | 98 web::BrowserState* context) const { |
| 98 const base::FilePath& browser_state_path = context->GetStatePath(); | 99 const base::FilePath& browser_state_path = context->GetStatePath(); |
| 99 return make_scoped_ptr(new WebDataServiceWrapper( | 100 return base::WrapUnique(new WebDataServiceWrapper( |
| 100 browser_state_path, GetApplicationContext()->GetApplicationLocale(), | 101 browser_state_path, GetApplicationContext()->GetApplicationLocale(), |
| 101 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), | 102 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
| 102 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), | 103 web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), |
| 103 ios::sync_start_util::GetFlareForSyncableService(browser_state_path), | 104 ios::sync_start_util::GetFlareForSyncableService(browser_state_path), |
| 104 &DoNothingOnErrorCallback)); | 105 &DoNothingOnErrorCallback)); |
| 105 } | 106 } |
| 106 | 107 |
| 107 web::BrowserState* WebDataServiceFactory::GetBrowserStateToUse( | 108 web::BrowserState* WebDataServiceFactory::GetBrowserStateToUse( |
| 108 web::BrowserState* context) const { | 109 web::BrowserState* context) const { |
| 109 return GetBrowserStateRedirectedInIncognito(context); | 110 return GetBrowserStateRedirectedInIncognito(context); |
| 110 } | 111 } |
| 111 | 112 |
| 112 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { | 113 bool WebDataServiceFactory::ServiceIsNULLWhileTesting() const { |
| 113 return true; | 114 return true; |
| 114 } | 115 } |
| 115 | 116 |
| 116 } // namespace ios | 117 } // namespace ios |
| OLD | NEW |