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 13 matching lines...) Expand all Loading... |
24 #include "components/signin/core/browser/webdata/token_service_table.h" | 24 #include "components/signin/core/browser/webdata/token_service_table.h" |
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) |
| 35 #include "components/payments/android/web_app_manifest_section_table.h" |
| 36 #endif |
| 37 |
34 namespace { | 38 namespace { |
35 | 39 |
36 void InitSyncableServicesOnDBThread( | 40 void InitSyncableServicesOnDBThread( |
37 scoped_refptr<base::SingleThreadTaskRunner> db_thread, | 41 scoped_refptr<base::SingleThreadTaskRunner> db_thread, |
38 const syncer::SyncableService::StartSyncFlare& sync_flare, | 42 const syncer::SyncableService::StartSyncFlare& sync_flare, |
39 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, | 43 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, |
40 const base::FilePath& context_path, | 44 const base::FilePath& context_path, |
41 const std::string& app_locale, | 45 const std::string& app_locale, |
42 autofill::AutofillWebDataBackend* autofill_backend) { | 46 autofill::AutofillWebDataBackend* autofill_backend) { |
43 DCHECK(db_thread->BelongsToCurrentThread()); | 47 DCHECK(db_thread->BelongsToCurrentThread()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const std::string& application_locale, | 83 const std::string& application_locale, |
80 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 84 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
81 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 85 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
82 const syncer::SyncableService::StartSyncFlare& flare, | 86 const syncer::SyncableService::StartSyncFlare& flare, |
83 const ShowErrorCallback& show_error_callback) { | 87 const ShowErrorCallback& show_error_callback) { |
84 base::FilePath path = context_path.Append(kWebDataFilename); | 88 base::FilePath path = context_path.Append(kWebDataFilename); |
85 web_database_ = new WebDatabaseService(path, ui_thread, db_thread); | 89 web_database_ = new WebDatabaseService(path, ui_thread, db_thread); |
86 | 90 |
87 // All tables objects that participate in managing the database must | 91 // All tables objects that participate in managing the database must |
88 // be added here. | 92 // be added here. |
89 web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable)); | 93 web_database_->AddTable(base::MakeUnique<autofill::AutofillTable>()); |
90 web_database_->AddTable(base::WrapUnique(new KeywordTable)); | 94 web_database_->AddTable(base::MakeUnique<KeywordTable>()); |
91 // TODO(mdm): We only really need the LoginsTable on Windows for IE7 password | 95 // TODO(mdm): We only really need the LoginsTable on Windows for IE7 password |
92 // access, but for now, we still create it on all platforms since it deletes | 96 // access, but for now, we still create it on all platforms since it deletes |
93 // the old logins table. We can remove this after a while, e.g. in M22 or so. | 97 // the old logins table. We can remove this after a while, e.g. in M22 or so. |
94 web_database_->AddTable(base::WrapUnique(new LoginsTable)); | 98 web_database_->AddTable(base::MakeUnique<LoginsTable>()); |
95 web_database_->AddTable(base::WrapUnique(new TokenServiceTable)); | 99 web_database_->AddTable(base::MakeUnique<TokenServiceTable>()); |
| 100 #if defined(OS_ANDROID) |
| 101 web_database_->AddTable( |
| 102 base::MakeUnique<payments::WebAppManifestSectionTable>()); |
| 103 #endif |
96 web_database_->LoadDatabase(); | 104 web_database_->LoadDatabase(); |
97 | 105 |
98 autofill_web_data_ = new autofill::AutofillWebDataService( | 106 autofill_web_data_ = new autofill::AutofillWebDataService( |
99 web_database_, ui_thread, db_thread, | 107 web_database_, ui_thread, db_thread, |
100 base::Bind(show_error_callback, ERROR_LOADING_AUTOFILL)); | 108 base::Bind(show_error_callback, ERROR_LOADING_AUTOFILL)); |
101 autofill_web_data_->Init(); | 109 autofill_web_data_->Init(); |
102 | 110 |
103 keyword_web_data_ = new KeywordWebDataService( | 111 keyword_web_data_ = new KeywordWebDataService( |
104 web_database_, ui_thread, | 112 web_database_, ui_thread, |
105 base::Bind(show_error_callback, ERROR_LOADING_KEYWORD)); | 113 base::Bind(show_error_callback, ERROR_LOADING_KEYWORD)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { | 158 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { |
151 return token_web_data_.get(); | 159 return token_web_data_.get(); |
152 } | 160 } |
153 | 161 |
154 #if defined(OS_WIN) | 162 #if defined(OS_WIN) |
155 scoped_refptr<PasswordWebDataService> | 163 scoped_refptr<PasswordWebDataService> |
156 WebDataServiceWrapper::GetPasswordWebData() { | 164 WebDataServiceWrapper::GetPasswordWebData() { |
157 return password_web_data_.get(); | 165 return password_web_data_.get(); |
158 } | 166 } |
159 #endif | 167 #endif |
OLD | NEW |