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

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

Issue 14103021: Use Observer to notify of WebDB load instead of callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix WIN builds 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
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"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void AutofillWebDataService::RemoveObserver( 161 void AutofillWebDataService::RemoveObserver(
162 AutofillWebDataServiceObserverOnUIThread* observer) { 162 AutofillWebDataServiceObserverOnUIThread* observer) {
163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
164 ui_observer_list_.RemoveObserver(observer); 164 ui_observer_list_.RemoveObserver(observer);
165 } 165 }
166 166
167 AutofillWebDataService::~AutofillWebDataService() {} 167 AutofillWebDataService::~AutofillWebDataService() {}
168 168
169 void AutofillWebDataService::NotifyDatabaseLoadedOnUIThread() {
170 // Notify that the database has been initialized.
171 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread,
172 ui_observer_list_,
173 WebDatabaseLoaded());
174 }
175
176 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
177 // 170 //
178 // Autofill implementation. 171 // Autofill implementation.
179 // 172 //
180 //////////////////////////////////////////////////////////////////////////////// 173 ////////////////////////////////////////////////////////////////////////////////
181 174
182 WebDatabase::State AutofillWebDataService::AddFormElementsImpl( 175 WebDatabase::State AutofillWebDataService::AddFormElementsImpl(
183 const std::vector<FormFieldData>& fields, WebDatabase* db) { 176 const std::vector<FormFieldData>& fields, WebDatabase* db) {
184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 177 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
185 AutofillChangeList changes; 178 AutofillChangeList changes;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 448 }
456 449
457 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() { 450 void AutofillWebDataService::NotifyAutofillMultipleChangedOnUIThread() {
458 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 451 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
459 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread, 452 FOR_EACH_OBSERVER(AutofillWebDataServiceObserverOnUIThread,
460 ui_observer_list_, 453 ui_observer_list_,
461 AutofillMultipleChanged()); 454 AutofillMultipleChanged());
462 } 455 }
463 456
464 } // namespace autofill 457 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698