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

Side by Side Diff: components/autofill/browser/webdata/autofill_webdata_service.cc

Issue 14081043: Hook up Autofill Backend interface to SyncableServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « components/autofill/browser/webdata/autofill_webdata_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill/browser/webdata/autofill_webdata_service.h" 5 #include "components/autofill/browser/webdata/autofill_webdata_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "components/autofill/browser/autofill_country.h" 9 #include "components/autofill/browser/autofill_country.h"
10 #include "components/autofill/browser/autofill_profile.h" 10 #include "components/autofill/browser/autofill_profile.h"
11 #include "components/autofill/browser/credit_card.h" 11 #include "components/autofill/browser/credit_card.h"
12 #include "components/autofill/browser/webdata/autofill_change.h" 12 #include "components/autofill/browser/webdata/autofill_change.h"
13 #include "components/autofill/browser/webdata/autofill_entry.h" 13 #include "components/autofill/browser/webdata/autofill_entry.h"
14 #include "components/autofill/browser/webdata/autofill_table.h" 14 #include "components/autofill/browser/webdata/autofill_table.h"
15 #include "components/autofill/browser/webdata/autofill_webdata_backend_impl.h" 15 #include "components/autofill/browser/webdata/autofill_webdata_backend_impl.h"
16 #include "components/autofill/browser/webdata/autofill_webdata_service_observer. h" 16 #include "components/autofill/browser/webdata/autofill_webdata_service_observer. h"
17 #include "components/autofill/common/form_field_data.h" 17 #include "components/autofill/common/form_field_data.h"
18 #include "components/webdata/common/web_data_service_backend.h" 18 #include "components/webdata/common/web_data_service_backend.h"
19 #include "components/webdata/common/web_database_service.h" 19 #include "components/webdata/common/web_database_service.h"
20 20
21 using base::Bind; 21 using base::Bind;
22 using base::Time; 22 using base::Time;
23 using content::BrowserThread; 23 using content::BrowserThread;
24 24
25 namespace autofill { 25 namespace autofill {
26 26
27 // static
28 void AutofillWebDataService::NotifyOfMultipleAutofillChanges(
29 AutofillWebDataService* web_data_service) {
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
31
32 if (!web_data_service)
33 return;
34
35 BrowserThread::PostTask(
36 BrowserThread::UI, FROM_HERE,
37 Bind(&AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread,
38 make_scoped_refptr(web_data_service)));
39 }
40
41 AutofillWebDataService::AutofillWebDataService( 27 AutofillWebDataService::AutofillWebDataService(
42 scoped_refptr<WebDatabaseService> wdbs, 28 scoped_refptr<WebDatabaseService> wdbs,
43 const ProfileErrorCallback& callback) 29 const ProfileErrorCallback& callback)
44 : WebDataServiceBase(wdbs, callback), 30 : WebDataServiceBase(wdbs, callback),
45 weak_ptr_factory_(this), 31 weak_ptr_factory_(this),
46 autofill_backend_(NULL) { 32 autofill_backend_(NULL) {
47 33
48 base::Closure on_changed_callback = Bind( 34 base::Closure on_changed_callback = Bind(
49 &AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread, 35 &AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread,
50 weak_ptr_factory_.GetWeakPtr()); 36 weak_ptr_factory_.GetWeakPtr());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 consumer); 77 consumer);
92 } 78 }
93 79
94 void AutofillWebDataService::RemoveFormElementsAddedBetween( 80 void AutofillWebDataService::RemoveFormElementsAddedBetween(
95 const Time& delete_begin, const Time& delete_end) { 81 const Time& delete_begin, const Time& delete_end) {
96 wdbs_->ScheduleDBTask(FROM_HERE, 82 wdbs_->ScheduleDBTask(FROM_HERE,
97 Bind(&AutofillWebDataBackendImpl::RemoveFormElementsAddedBetween, 83 Bind(&AutofillWebDataBackendImpl::RemoveFormElementsAddedBetween,
98 autofill_backend_, delete_begin, delete_end)); 84 autofill_backend_, delete_begin, delete_end));
99 } 85 }
100 86
101 void AutofillWebDataService::RemoveExpiredFormElements() {
102 wdbs_->ScheduleDBTask(FROM_HERE,
103 Bind(&AutofillWebDataBackendImpl::RemoveExpiredFormElements,
104 autofill_backend_));
105 }
106
107 void AutofillWebDataService::RemoveFormValueForElementName( 87 void AutofillWebDataService::RemoveFormValueForElementName(
108 const base::string16& name, const base::string16& value) { 88 const base::string16& name, const base::string16& value) {
109 wdbs_->ScheduleDBTask(FROM_HERE, 89 wdbs_->ScheduleDBTask(FROM_HERE,
110 Bind(&AutofillWebDataBackendImpl::RemoveFormValueForElementName, 90 Bind(&AutofillWebDataBackendImpl::RemoveFormValueForElementName,
111 autofill_backend_, name, value)); 91 autofill_backend_, name, value));
112 } 92 }
113 93
114 void AutofillWebDataService::AddAutofillProfile( 94 void AutofillWebDataService::AddAutofillProfile(
115 const AutofillProfile& profile) { 95 const AutofillProfile& profile) {
116 wdbs_->ScheduleDBTask(FROM_HERE, 96 wdbs_->ScheduleDBTask(FROM_HERE,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 215 }
236 216
237 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() { 217 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() {
238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
239 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread, 219 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread,
240 ui_observer_list_, 220 ui_observer_list_,
241 AutofillMultipleChanged()); 221 AutofillMultipleChanged());
242 } 222 }
243 223
244 } // namespace autofill 224 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/webdata/autofill_webdata_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698