Index: components/autofill/browser/webdata/autofill_backend_delegate.h |
diff --git a/components/autofill/browser/webdata/autofill_backend_delegate.h b/components/autofill/browser/webdata/autofill_backend_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..afa689adc57f3b71f83e4b6137d4975e5344e18c |
--- /dev/null |
+++ b/components/autofill/browser/webdata/autofill_backend_delegate.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |
+#define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback_forward.h" |
+#include "base/compiler_specific.h" |
+#include "base/memory/weak_ptr.h" |
+ |
+class WebDatabase; |
+ |
+namespace autofill { |
+ |
+class AutofillWebDataBackend; |
+class AutofillWebDataServiceObserverOnDBThread; |
+class AutofillWebDataService; |
+ |
+// Delegate class for doing Autofill work directly on the DB thread (used by |
+// Sync, mostly), without fully exposing the AutofillWebDataBackend to clients. |
+class AutofillBackendDelegate { |
+ public: |
+ AutofillBackendDelegate( |
+ base::WeakPtr<WebDatabase> db, |
+ base::WeakPtr<AutofillWebDataBackend> autofill_backend); |
+ |
+ ~AutofillBackendDelegate(); |
+ |
+ WebDatabase* GetDatabase(); |
+ |
+ // Add an observer to |autofill_backend_|. |
+ void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
+ |
+ // Remove an observer from |autofill_backend_|. |
+ void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
+ |
+ // Remove expired elements from |web_database_| and commit if needed. |
+ void RemoveExpiredFormElements(); |
+ |
+ // Notifies listeners on the UI thread that multiple changes have been made to |
+ // to Autofill records of the database. |
+ // NOTE: This method is intended to be called from the DB thread. It |
+ // it asynchronously notifies listeners on the UI thread. |
+ // |web_data_service| may be NULL for testing purposes. |
+ void NotifyOfMultipleAutofillChanges( |
+ AutofillWebDataService* web_data_service); |
+ |
+ private: |
+ base::WeakPtr<WebDatabase> web_database_; |
+ base::WeakPtr<AutofillWebDataBackend> autofill_backend_; |
+ |
+}; |
+ |
+} // autofill |
+ |
+#endif //COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |