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

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

Issue 1852513003: Convert //android_webview to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git is hard Created 4 years, 8 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 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
9 #include "components/autofill/core/browser/webdata/autofill_table.h" 10 #include "components/autofill/core/browser/webdata/autofill_table.h"
10 #include "components/webdata/common/webdata_constants.h" 11 #include "components/webdata/common/webdata_constants.h"
11 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
12 13
13 using base::WaitableEvent; 14 using base::WaitableEvent;
14 using content::BrowserThread; 15 using content::BrowserThread;
15 16
16 namespace { 17 namespace {
17 18
18 // Callback to handle database error. It seems chrome uses this to 19 // Callback to handle database error. It seems chrome uses this to
19 // display an error dialog box only. 20 // display an error dialog box only.
20 void DatabaseErrorCallback(sql::InitStatus status) { 21 void DatabaseErrorCallback(sql::InitStatus status) {
21 LOG(WARNING) << "initializing autocomplete database failed"; 22 LOG(WARNING) << "initializing autocomplete database failed";
22 } 23 }
23 24
24 } // namespace 25 } // namespace
25 26
26 namespace android_webview { 27 namespace android_webview {
27 28
28 AwFormDatabaseService::AwFormDatabaseService(const base::FilePath path) { 29 AwFormDatabaseService::AwFormDatabaseService(const base::FilePath path) {
29 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 30 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
30 web_database_ = new WebDatabaseService(path.Append(kWebDataFilename), 31 web_database_ = new WebDatabaseService(path.Append(kWebDataFilename),
31 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 32 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
32 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)); 33 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB));
33 web_database_->AddTable(make_scoped_ptr(new autofill::AutofillTable)); 34 web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable));
34 web_database_->LoadDatabase(); 35 web_database_->LoadDatabase();
35 36
36 autofill_data_ = new autofill::AutofillWebDataService( 37 autofill_data_ = new autofill::AutofillWebDataService(
37 web_database_, 38 web_database_,
38 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), 40 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB),
40 base::Bind(&DatabaseErrorCallback)); 41 base::Bind(&DatabaseErrorCallback));
41 autofill_data_->Init(); 42 autofill_data_->Init();
42 } 43 }
43 44
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (it == result_map_.end()) { 118 if (it == result_map_.end()) {
118 LOG(WARNING) << "Received unexpected callback from web data service"; 119 LOG(WARNING) << "Received unexpected callback from web data service";
119 return; 120 return;
120 } 121 }
121 *(it->second.result) = has_form_data; 122 *(it->second.result) = has_form_data;
122 it->second.completion->Signal(); 123 it->second.completion->Signal();
123 result_map_.erase(h); 124 result_map_.erase(h);
124 } 125 }
125 126
126 } // namespace android_webview 127 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698