Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: android_webview/browser/aw_form_database_service.cc

Issue 25870002: Abstract BrowserThread knowledge out of AutofillWebDataService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up test constructor Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/synchronization/waitable_event.h" 7 #include "base/synchronization/waitable_event.h"
8 #include "components/autofill/core/browser/webdata/autofill_table.h" 8 #include "components/autofill/core/browser/webdata/autofill_table.h"
9 #include "components/webdata/common/webdata_constants.h" 9 #include "components/webdata/common/webdata_constants.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 18 matching lines...) Expand all
29 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 29 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
30 web_database_ = new WebDatabaseService(path.Append(kWebDataFilename), 30 web_database_ = new WebDatabaseService(path.Append(kWebDataFilename),
31 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 31 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
32 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); 32 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
33 web_database_->AddTable( 33 web_database_->AddTable(
34 scoped_ptr<WebDatabaseTable>(new autofill::AutofillTable( 34 scoped_ptr<WebDatabaseTable>(new autofill::AutofillTable(
35 l10n_util::GetDefaultLocale()))); 35 l10n_util::GetDefaultLocale())));
36 web_database_->LoadDatabase(); 36 web_database_->LoadDatabase();
37 37
38 autofill_data_ = new autofill::AutofillWebDataService( 38 autofill_data_ = new autofill::AutofillWebDataService(
39 web_database_, base::Bind(&DatabaseErrorCallback)); 39 web_database_,
40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
41 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
42 base::Bind(&DatabaseErrorCallback));
40 autofill_data_->Init(); 43 autofill_data_->Init();
41 } 44 }
42 45
43 AwFormDatabaseService::~AwFormDatabaseService() { 46 AwFormDatabaseService::~AwFormDatabaseService() {
44 Shutdown(); 47 Shutdown();
45 } 48 }
46 49
47 void AwFormDatabaseService::Shutdown() { 50 void AwFormDatabaseService::Shutdown() {
48 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
49 DCHECK(result_map_.empty()); 52 DCHECK(result_map_.empty());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (it == result_map_.end()) { 118 if (it == result_map_.end()) {
116 LOG(WARNING) << "Received unexpected callback from web data service"; 119 LOG(WARNING) << "Received unexpected callback from web data service";
117 return; 120 return;
118 } 121 }
119 *(it->second.result) = has_form_data; 122 *(it->second.result) = has_form_data;
120 it->second.completion->Signal(); 123 it->second.completion->Signal();
121 result_map_.erase(h); 124 result_map_.erase(h);
122 } 125 }
123 126
124 } // namespace android_webview 127 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698