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

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

Issue 14348036: Move AutofillWebData DB methods into separate class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up Created 7 years, 8 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
new file mode 100644
index 0000000000000000000000000000000000000000..dcfa63595ab1368489acb613bd90e83b3ee5b496
--- /dev/null
+++ b/components/autofill/browser/webdata/autofill_webdata_backend.h
@@ -0,0 +1,81 @@
+#ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_
+#define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/observer_list.h"
+#include "components/autofill/browser/webdata/autofill_webdata.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"
+
+namespace autofill {
+
+class AutofillChange;
+class AutofillProfile;
+class AutofillWebDataServiceObserverOnDBThread;
+class CreditCard;
+
+class AutofillWebDataBackend
Ilya Sherman 2013/04/30 00:14:08 Please add documentation describing the purpose of
Cait (Slow) 2013/04/30 22:24:40 Done.
+ : public base::RefCountedThreadSafe<AutofillWebDataBackend,
+ content::BrowserThread::DeleteOnDBThread> {
Ilya Sherman 2013/04/30 00:14:08 Why is this class reference counted, rather than s
Cait (Slow) 2013/04/30 22:24:40 It needs to be ref-counted as AutofillWebDataServi
Ilya Sherman 2013/04/30 23:52:11 Seems like the AutofillWebDataService could just h
Cait (Slow) 2013/05/01 23:14:19 The async tasks have non-void return types (either
+ public:
+ AutofillWebDataBackend();
+
+ WebDatabase::State AddFormElementsImpl(
Ilya Sherman 2013/04/30 00:14:08 nit: Could we drop the "Impl" suffix for all of th
Cait (Slow) 2013/04/30 22:24:40 Done.
+ const std::vector<FormFieldData>& fields, WebDatabase* db);
Ilya Sherman 2013/04/30 00:14:08 nit: Please leave a blank line after each method d
Ilya Sherman 2013/04/30 00:14:08 nit: If the entire method declaration doesn't fit
Cait (Slow) 2013/04/30 22:24:40 Done.
Cait (Slow) 2013/04/30 22:24:40 Done.
+ scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl(
+ const base::string16& name, const base::string16& prefix, int limit,
+ WebDatabase* db);
+ WebDatabase::State RemoveFormElementsAddedBetweenImpl(
+ const base::Time& delete_begin, const base::Time& delete_end,
+ WebDatabase* db);
+ WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db);
+ WebDatabase::State RemoveFormValueForElementNameImpl(
+ const base::string16& name, const base::string16& value, WebDatabase* db);
+ WebDatabase::State AddAutofillProfileImpl(
+ const AutofillProfile& profile, WebDatabase* db);
+ WebDatabase::State UpdateAutofillProfileImpl(
+ const AutofillProfile& profile, WebDatabase* db);
+ WebDatabase::State RemoveAutofillProfileImpl(
+ const std::string& guid, WebDatabase* db);
+ scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(WebDatabase* db);
+ WebDatabase::State AddCreditCardImpl(
+ const CreditCard& credit_card, WebDatabase* db);
+ WebDatabase::State UpdateCreditCardImpl(
+ const CreditCard& credit_card, WebDatabase* db);
+ WebDatabase::State RemoveCreditCardImpl(
+ const std::string& guid, WebDatabase* db);
+ scoped_ptr<WDTypedResult> GetCreditCardsImpl(WebDatabase* db);
+ WebDatabase::State RemoveAutofillDataModifiedBetweenImpl(
+ const base::Time& delete_begin, const base::Time& delete_end,
+ WebDatabase* db);
+
+ void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer);
+ void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer);
+
+ protected:
+ virtual ~AutofillWebDataBackend();
+
+ private:
+ friend struct content::BrowserThread::DeleteOnThread<
+ content::BrowserThread::DB>;
+ friend class base::DeleteHelper<AutofillWebDataBackend>;
+ // We have to friend RCTS<> so WIN shared-lib build is happy (crbug/112250).
Ilya Sherman 2013/04/30 00:14:08 nit: Please prepend "http://" to the URL so that i
Cait (Slow) 2013/04/30 22:24:40 Done.
+ friend class base::RefCountedThreadSafe<AutofillWebDataBackend,
+ content::BrowserThread::DeleteOnDBThread>;
+
+ // Callbacks to ensure that sensitive info is destroyed if request is
+ // cancelled.
+ void DestroyAutofillProfileResult(const WDTypedResult* result);
+ void DestroyAutofillCreditCardResult(const WDTypedResult* result);
+
+ ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(AutofillWebDataBackend);
+};
+
+} // namespace autofill
+
+#endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_
Ilya Sherman 2013/04/30 00:14:08 Any chance you could convince the source control t
Cait (Slow) 2013/04/30 22:24:40 Done.

Powered by Google App Engine
This is Rietveld 408576698