OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "android_webview/browser/aw_form_database_service.h" | 5 #include "android_webview/browser/aw_form_database_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "components/autofill/core/browser/webdata/autofill_table.h" | 10 #include "components/autofill/core/browser/webdata/autofill_table.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 void DatabaseErrorCallback(sql::InitStatus status) { | 21 void DatabaseErrorCallback(sql::InitStatus status) { |
22 LOG(WARNING) << "initializing autocomplete database failed"; | 22 LOG(WARNING) << "initializing autocomplete database failed"; |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 namespace android_webview { | 27 namespace android_webview { |
28 | 28 |
29 AwFormDatabaseService::AwFormDatabaseService(const base::FilePath path) { | 29 AwFormDatabaseService::AwFormDatabaseService(const base::FilePath path) { |
30 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 30 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
31 web_database_ = new WebDatabaseService(path.Append(kWebDataFilename), | 31 web_database_ = new WebDatabaseService( |
32 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 32 path.Append(kWebDataFilename), |
33 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); | 33 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
| 34 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); |
34 web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable)); | 35 web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable)); |
35 web_database_->LoadDatabase(); | 36 web_database_->LoadDatabase(); |
36 | 37 |
37 autofill_data_ = new autofill::AutofillWebDataService( | 38 autofill_data_ = new autofill::AutofillWebDataService( |
38 web_database_, | 39 web_database_, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI), |
39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 40 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), |
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | |
41 base::Bind(&DatabaseErrorCallback)); | 41 base::Bind(&DatabaseErrorCallback)); |
42 autofill_data_->Init(); | 42 autofill_data_->Init(); |
43 } | 43 } |
44 | 44 |
45 AwFormDatabaseService::~AwFormDatabaseService() { | 45 AwFormDatabaseService::~AwFormDatabaseService() { |
46 Shutdown(); | 46 Shutdown(); |
47 } | 47 } |
48 | 48 |
49 void AwFormDatabaseService::Shutdown() { | 49 void AwFormDatabaseService::Shutdown() { |
50 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 50 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (it == result_map_.end()) { | 119 if (it == result_map_.end()) { |
120 LOG(WARNING) << "Received unexpected callback from web data service"; | 120 LOG(WARNING) << "Received unexpected callback from web data service"; |
121 return; | 121 return; |
122 } | 122 } |
123 *(it->second.result) = has_form_data; | 123 *(it->second.result) = has_form_data; |
124 it->second.completion->Signal(); | 124 it->second.completion->Signal(); |
125 result_map_.erase(h); | 125 result_map_.erase(h); |
126 } | 126 } |
127 | 127 |
128 } // namespace android_webview | 128 } // namespace android_webview |
OLD | NEW |