Chromium Code Reviews| Index: components/autofill/browser/webdata/autofill_webdata_backend_impl.h |
| diff --git a/components/autofill/browser/webdata/autofill_webdata_backend.h b/components/autofill/browser/webdata/autofill_webdata_backend_impl.h |
| similarity index 74% |
| copy from components/autofill/browser/webdata/autofill_webdata_backend.h |
| copy to components/autofill/browser/webdata/autofill_webdata_backend_impl.h |
| index b1ab6d63b089552b6c7f2106f0384181589e0374..c5bad9cf418ad3693a4bd30d010e21200ecd55bf 100644 |
| --- a/components/autofill/browser/webdata/autofill_webdata_backend.h |
| +++ b/components/autofill/browser/webdata/autofill_webdata_backend_impl.h |
| @@ -2,18 +2,22 @@ |
| // 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_WEBDATA_BACKEND_H_ |
| -#define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_ |
| +#ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ |
| +#define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_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/autofill_webdata_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; |
| @@ -26,11 +30,27 @@ class CreditCard; |
| // in it should only be called from that thread. Most functions here are just |
| // the implementations of the corresponding functions in the Autofill |
| // WebDataService. |
| -class AutofillWebDataBackend |
| - : public base::RefCountedThreadSafe<AutofillWebDataBackend, |
| - content::BrowserThread::DeleteOnDBThread> { |
| +class AutofillWebDataBackendImpl |
| + : public base::RefCountedThreadSafe<AutofillWebDataBackendImpl, |
| + content::BrowserThread::DeleteOnDBThread>, |
| + public AutofillWebDataBackend { |
| public: |
| - AutofillWebDataBackend(); |
| + // |web_db_backend| is used to access the WebDatabase directly for |
|
Ilya Sherman
2013/05/09 05:04:24
nit: Please update the variable name here.
Cait (Slow)
2013/05/09 18:29:54
Done.
|
| + // Sync-related operations. |on_changed_callback| is a closure which can be |
| + // used to notify the UI thread of changes initiated by Sync (this callback |
| + // may be called multiple times). |
| + AutofillWebDataBackendImpl( |
| + scoped_refptr<WebDataServiceBackend> web_database_backend, |
| + const base::Closure& on_changed_callback); |
| + |
| + // AutofillWebDataBackend implementation. |
| + virtual void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer) |
| + OVERRIDE; |
| + virtual void RemoveObserver( |
| + AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE; |
| + virtual WebDatabase* GetDatabase() 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,22 +115,16 @@ 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(); |
| + virtual ~AutofillWebDataBackendImpl(); |
| private: |
| friend struct content::BrowserThread::DeleteOnThread< |
| content::BrowserThread::DB>; |
| - friend class base::DeleteHelper<AutofillWebDataBackend>; |
| + friend class base::DeleteHelper<AutofillWebDataBackendImpl>; |
| // We have to friend RCTS<> so WIN shared-lib build is happy |
| // (http://crbug/112250). |
| - friend class base::RefCountedThreadSafe<AutofillWebDataBackend, |
| + friend class base::RefCountedThreadSafe<AutofillWebDataBackendImpl, |
| content::BrowserThread::DeleteOnDBThread>; |
| // Callbacks to ensure that sensitive info is destroyed if request is |
| @@ -120,9 +134,15 @@ class AutofillWebDataBackend |
| ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; |
| - DISALLOW_COPY_AND_ASSIGN(AutofillWebDataBackend); |
| + // WebDataServiceBackend allows direct access to DB. |
| + // 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(AutofillWebDataBackendImpl); |
| }; |
| } // namespace autofill |
| -#endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_H_ |
| +#endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ |