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

Unified Diff: components/autofill/browser/webdata/autofill_webdata_backend.h

Issue 14679005: Create an AutofillBackend interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert delegate to interface 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/webdata/autofill_webdata_backend.h
diff --git a/components/autofill/browser/webdata/autofill_webdata_backend.h b/components/autofill/browser/webdata/autofill_webdata_backend.h
index b1ab6d63b089552b6c7f2106f0384181589e0374..3574258ee3872f0f31006d426ead949bcec2e7fc 100644
--- a/components/autofill/browser/webdata/autofill_webdata_backend.h
+++ b/components/autofill/browser/webdata/autofill_webdata_backend.h
@@ -6,14 +6,18 @@
#define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_
#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "components/autofill/browser/webdata/autofill_webdata.h"
+#include "components/autofill/browser/webdata/syncable_service_backend.h"
#include "components/autofill/common/form_field_data.h"
#include "components/webdata/common/web_data_results.h"
#include "components/webdata/common/web_data_service_base.h"
#include "components/webdata/common/web_data_service_consumer.h"
#include "components/webdata/common/web_database.h"
+class WebDataServiceBackend;
+
namespace autofill {
class AutofillChange;
@@ -28,9 +32,23 @@ class CreditCard;
// WebDataService.
class AutofillWebDataBackend
: public base::RefCountedThreadSafe<AutofillWebDataBackend,
- content::BrowserThread::DeleteOnDBThread> {
+ content::BrowserThread::DeleteOnDBThread>,
+ public SyncableServiceBackend {
public:
- AutofillWebDataBackend();
+ // |web_db_backend| is used to access the Database directly for Sync-related
+ // operations. |on_changed_callback| is a closure which can be used to notify
+ // the UI thread of these changes.
Jói 2013/05/07 19:39:41 "these changes" is a little ambiguous
Cait (Slow) 2013/05/07 20:14:56 Done.
+ AutofillWebDataBackend(scoped_refptr<WebDataServiceBackend> web_db_backend,
+ const base::Closure& on_changed_callback);
+
+ // SyncableServiceBackend implementation.
+ virtual void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer)
+ OVERRIDE;
+ virtual void RemoveObserver(
+ AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE;
+ virtual WebDatabase* GetDatabaseOnDB() OVERRIDE;
+ virtual void RemoveExpiredFormElementsWrapper() OVERRIDE;
+ virtual void NotifyOfMultipleAutofillChanges() OVERRIDE;
// Adds form fields to the web database.
WebDatabase::State AddFormElements(const std::vector<FormFieldData>& fields,
@@ -95,12 +113,6 @@ class AutofillWebDataBackend
const base::Time& delete_end,
WebDatabase* db);
- // Add an observer to be notified of changes on the DB thread.
- void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer);
-
- // Remove an observer.
- void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer);
-
protected:
virtual ~AutofillWebDataBackend();
@@ -120,6 +132,11 @@ class AutofillWebDataBackend
ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_;
+ // Delegate which allows clients to do autofill work directly on th DB thread.
+ scoped_refptr<WebDataServiceBackend> web_database_backend_;
+
+ scoped_ptr<base::Closure> on_changed_callback_;
+
DISALLOW_COPY_AND_ASSIGN(AutofillWebDataBackend);
};

Powered by Google App Engine
This is Rietveld 408576698