| 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/webdata_services/web_data_service_wrapper.h" | 5 #include "components/webdata_services/web_data_service_wrapper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "components/signin/core/browser/webdata/token_web_data.h" | 25 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 26 #include "components/sync/driver/sync_driver_switches.h" | 26 #include "components/sync/driver/sync_driver_switches.h" |
| 27 #include "components/webdata/common/web_database_service.h" | 27 #include "components/webdata/common/web_database_service.h" |
| 28 #include "components/webdata/common/webdata_constants.h" | 28 #include "components/webdata/common/webdata_constants.h" |
| 29 | 29 |
| 30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 31 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" | 31 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 35 #include "components/payments/android/payment_manifest_web_data_service.h" |
| 35 #include "components/payments/android/payment_method_manifest_table.h" | 36 #include "components/payments/android/payment_method_manifest_table.h" |
| 36 #include "components/payments/android/web_app_manifest_section_table.h" | 37 #include "components/payments/android/web_app_manifest_section_table.h" |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 void InitSyncableServicesOnDBThread( | 42 void InitSyncableServicesOnDBThread( |
| 42 scoped_refptr<base::SingleThreadTaskRunner> db_thread, | 43 scoped_refptr<base::SingleThreadTaskRunner> db_thread, |
| 43 const syncer::SyncableService::StartSyncFlare& sync_flare, | 44 const syncer::SyncableService::StartSyncFlare& sync_flare, |
| 44 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, | 45 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 base::Bind(show_error_callback, ERROR_LOADING_TOKEN)); | 122 base::Bind(show_error_callback, ERROR_LOADING_TOKEN)); |
| 122 token_web_data_->Init(); | 123 token_web_data_->Init(); |
| 123 | 124 |
| 124 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
| 125 password_web_data_ = new PasswordWebDataService( | 126 password_web_data_ = new PasswordWebDataService( |
| 126 web_database_, ui_thread, | 127 web_database_, ui_thread, |
| 127 base::Bind(show_error_callback, ERROR_LOADING_PASSWORD)); | 128 base::Bind(show_error_callback, ERROR_LOADING_PASSWORD)); |
| 128 password_web_data_->Init(); | 129 password_web_data_->Init(); |
| 129 #endif | 130 #endif |
| 130 | 131 |
| 132 #if defined(OS_ANDROID) |
| 133 payment_manifest_web_data_ = new payments::PaymentManifestWebDataService( |
| 134 web_database_, |
| 135 base::Bind(show_error_callback, ERROR_LOADING_PAYMENT_MANIFEST), |
| 136 ui_thread); |
| 137 #endif |
| 138 |
| 131 autofill_web_data_->GetAutofillBackend( | 139 autofill_web_data_->GetAutofillBackend( |
| 132 base::Bind(&InitSyncableServicesOnDBThread, db_thread, flare, | 140 base::Bind(&InitSyncableServicesOnDBThread, db_thread, flare, |
| 133 autofill_web_data_, context_path, application_locale)); | 141 autofill_web_data_, context_path, application_locale)); |
| 134 } | 142 } |
| 135 | 143 |
| 136 WebDataServiceWrapper::~WebDataServiceWrapper() { | 144 WebDataServiceWrapper::~WebDataServiceWrapper() { |
| 137 } | 145 } |
| 138 | 146 |
| 139 void WebDataServiceWrapper::Shutdown() { | 147 void WebDataServiceWrapper::Shutdown() { |
| 140 autofill_web_data_->ShutdownOnUIThread(); | 148 autofill_web_data_->ShutdownOnUIThread(); |
| 141 keyword_web_data_->ShutdownOnUIThread(); | 149 keyword_web_data_->ShutdownOnUIThread(); |
| 142 token_web_data_->ShutdownOnUIThread(); | 150 token_web_data_->ShutdownOnUIThread(); |
| 143 | 151 |
| 144 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
| 145 password_web_data_->ShutdownOnUIThread(); | 153 password_web_data_->ShutdownOnUIThread(); |
| 146 #endif | 154 #endif |
| 147 | 155 |
| 156 #if defined(OS_ANDROID) |
| 157 payment_manifest_web_data_->ShutdownOnUIThread(); |
| 158 #endif |
| 159 |
| 148 web_database_->ShutdownDatabase(); | 160 web_database_->ShutdownDatabase(); |
| 149 } | 161 } |
| 150 | 162 |
| 151 scoped_refptr<autofill::AutofillWebDataService> | 163 scoped_refptr<autofill::AutofillWebDataService> |
| 152 WebDataServiceWrapper::GetAutofillWebData() { | 164 WebDataServiceWrapper::GetAutofillWebData() { |
| 153 return autofill_web_data_.get(); | 165 return autofill_web_data_.get(); |
| 154 } | 166 } |
| 155 | 167 |
| 156 scoped_refptr<KeywordWebDataService> | 168 scoped_refptr<KeywordWebDataService> |
| 157 WebDataServiceWrapper::GetKeywordWebData() { | 169 WebDataServiceWrapper::GetKeywordWebData() { |
| 158 return keyword_web_data_.get(); | 170 return keyword_web_data_.get(); |
| 159 } | 171 } |
| 160 | 172 |
| 161 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { | 173 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { |
| 162 return token_web_data_.get(); | 174 return token_web_data_.get(); |
| 163 } | 175 } |
| 164 | 176 |
| 165 #if defined(OS_WIN) | 177 #if defined(OS_WIN) |
| 166 scoped_refptr<PasswordWebDataService> | 178 scoped_refptr<PasswordWebDataService> |
| 167 WebDataServiceWrapper::GetPasswordWebData() { | 179 WebDataServiceWrapper::GetPasswordWebData() { |
| 168 return password_web_data_.get(); | 180 return password_web_data_.get(); |
| 169 } | 181 } |
| 170 #endif | 182 #endif |
| 183 |
| 184 #if defined(OS_ANDROID) |
| 185 scoped_refptr<payments::PaymentManifestWebDataService> |
| 186 WebDataServiceWrapper::GetPaymentManifestWebData() { |
| 187 return payment_manifest_web_data_.get(); |
| 188 } |
| 189 #endif |
| OLD | NEW |