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

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: Comments pt 1 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..39e6709639c1e866041d744e0ca4b6e3c86c4659 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 WebDatabase directly for
+ // Sync-related operations. |on_changed_callback| is a closure which can be
+ // used to notify the UI thread of changes initiated by Sync.
Ilya Sherman 2013/05/08 00:39:06 Please document that |on_changed_callback| might b
Cait (Slow) 2013/05/08 19:16:01 Done.
+ AutofillWebDataBackend(scoped_refptr<WebDataServiceBackend> web_db_backend,
Ilya Sherman 2013/05/08 00:39:06 nit: Please name this variable |web_database_backe
Cait (Slow) 2013/05/08 19:16:01 Adding a todo to rename WebDataServiceBackend to W
+ const base::Closure& on_changed_callback);
+
+ // SyncableServiceBackend implementation.
+ virtual void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer)
+ OVERRIDE;
Ilya Sherman 2013/05/08 00:39:06 nit: Indent two more spaces.
Cait (Slow) 2013/05/08 19:16:01 Done.
+ virtual void RemoveObserver(
+ AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE;
Ilya Sherman 2013/05/08 00:39:06 nit: Indent two more spaces.
Cait (Slow) 2013/05/08 19:16:01 Done.
+ 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,12 @@ class AutofillWebDataBackend
ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_;
+ // Ptr to WebDataServiceBackend to allow direct access to DB.
Ilya Sherman 2013/05/08 00:39:06 nit: Omit "Ptr to"
Cait (Slow) 2013/05/08 19:16:01 Done.
+ // TODO(caitkp): Make it so nobody but us needs direct DB access anymore.
+ 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