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

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

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.cc
diff --git a/components/autofill/browser/webdata/autofill_webdata_backend.cc b/components/autofill/browser/webdata/autofill_webdata_backend.cc
index 0cda3d15310d9e4796315c7be1d2442af50caffb..09b0a62bacaf5b7c8d38b70a2f4e9c6158d30666 100644
--- a/components/autofill/browser/webdata/autofill_webdata_backend.cc
+++ b/components/autofill/browser/webdata/autofill_webdata_backend.cc
@@ -14,6 +14,7 @@
#include "components/autofill/browser/webdata/autofill_table.h"
#include "components/autofill/browser/webdata/autofill_webdata_service_observer.h"
#include "components/autofill/common/form_field_data.h"
+#include "components/webdata/common/web_data_service_backend.h"
using base::Bind;
using base::Time;
@@ -21,7 +22,11 @@ using content::BrowserThread;
namespace autofill {
-AutofillWebDataBackend::AutofillWebDataBackend() {
+AutofillWebDataBackend::AutofillWebDataBackend(
+ scoped_refptr<WebDataServiceBackend> web_db_backend,
+ const base::Closure& on_changed_callback)
+ : web_database_backend_(web_db_backend),
+ on_changed_callback_(new base::Closure(on_changed_callback)) {
}
void AutofillWebDataBackend::AddObserver(
@@ -36,7 +41,34 @@ void AutofillWebDataBackend::RemoveObserver(
db_observer_list_.RemoveObserver(observer);
}
-AutofillWebDataBackend::~AutofillWebDataBackend() {
+WebDatabase* AutofillWebDataBackend::GetDatabaseOnDB() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ if (!web_database_backend_)
+ return NULL;
+
+ return web_database_backend_->database();
+}
+
+void AutofillWebDataBackend::RemoveExpiredFormElementsWrapper() {
+ if (!web_database_backend_ || !web_database_backend_->database())
+ return;
+
+ if (RemoveExpiredFormElements(web_database_backend_->database()) ==
+ WebDatabase::COMMIT_NEEDED) {
+ web_database_backend_->database()->CommitTransaction();
+ web_database_backend_->database()->BeginTransaction();
+ }
+}
+
+void AutofillWebDataBackend::NotifyOfMultipleAutofillChanges() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+
+ if (!on_changed_callback_ .get()|| on_changed_callback_->is_null())
Jói 2013/05/07 19:39:41 no space before .get()
Cait (Slow) 2013/05/07 20:14:56 Done.
+ return;
+ BrowserThread::PostTask(
+ BrowserThread::UI,
Jói 2013/05/07 19:39:41 these can align to the parenthesis (with the first
Cait (Slow) 2013/05/07 20:14:56 Done.
+ FROM_HERE,
+ *(on_changed_callback_.get());
}
WebDatabase::State AutofillWebDataBackend::AddFormElements(
@@ -295,6 +327,9 @@ WebDatabase::State
return WebDatabase::COMMIT_NOT_NEEDED;
}
+AutofillWebDataBackend::~AutofillWebDataBackend() {
+}
+
void AutofillWebDataBackend::DestroyAutofillProfileResult(
const WDTypedResult* result) {
DCHECK(result->GetType() == AUTOFILL_PROFILES_RESULT);

Powered by Google App Engine
This is Rietveld 408576698