| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 AutofillWebDataBackendImpl( | 42 AutofillWebDataBackendImpl( |
| 43 scoped_refptr<WebDataServiceBackend> web_database_backend, | 43 scoped_refptr<WebDataServiceBackend> web_database_backend, |
| 44 const base::Closure& on_changed_callback); | 44 const base::Closure& on_changed_callback); |
| 45 | 45 |
| 46 // AutofillWebDataBackend implementation. | 46 // AutofillWebDataBackend implementation. |
| 47 virtual void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer) | 47 virtual void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer) |
| 48 OVERRIDE; | 48 OVERRIDE; |
| 49 virtual void RemoveObserver( | 49 virtual void RemoveObserver( |
| 50 AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE; | 50 AutofillWebDataServiceObserverOnDBThread* observer) OVERRIDE; |
| 51 virtual WebDatabase* GetDatabase() OVERRIDE; | 51 virtual WebDatabase* GetDatabase() OVERRIDE; |
| 52 virtual void RemoveExpiredFormElementsWrapper() OVERRIDE; | 52 virtual void RemoveExpiredFormElements() OVERRIDE; |
| 53 virtual void NotifyOfMultipleAutofillChanges() OVERRIDE; | 53 virtual void NotifyOfMultipleAutofillChanges() OVERRIDE; |
| 54 | 54 |
| 55 // Adds form fields to the web database. | 55 // Adds form fields to the web database. |
| 56 WebDatabase::State AddFormElements(const std::vector<FormFieldData>& fields, | 56 WebDatabase::State AddFormElements(const std::vector<FormFieldData>& fields, |
| 57 WebDatabase* db); | 57 WebDatabase* db); |
| 58 | 58 |
| 59 // Returns a vector of values which have been entered in form input fields | 59 // Returns a vector of values which have been entered in form input fields |
| 60 // named |name|. | 60 // named |name|. |
| 61 scoped_ptr<WDTypedResult> GetFormValuesForElementName( | 61 scoped_ptr<WDTypedResult> GetFormValuesForElementName( |
| 62 const base::string16& name, | 62 const base::string16& name, |
| 63 const base::string16& prefix, | 63 const base::string16& prefix, |
| 64 int limit, | 64 int limit, |
| 65 WebDatabase* db); | 65 WebDatabase* db); |
| 66 | 66 |
| 67 // Returns true if there are any elements in the form. | 67 // Returns true if there are any elements in the form. |
| 68 scoped_ptr<WDTypedResult> HasFormElements(WebDatabase* db); | 68 scoped_ptr<WDTypedResult> HasFormElements(WebDatabase* db); |
| 69 | 69 |
| 70 // Removes form elements recorded for Autocomplete from the database. | 70 // Removes form elements recorded for Autocomplete from the database. |
| 71 WebDatabase::State RemoveFormElementsAddedBetween( | 71 WebDatabase::State RemoveFormElementsAddedBetween( |
| 72 const base::Time& delete_begin, | 72 const base::Time& delete_begin, |
| 73 const base::Time& delete_end, | 73 const base::Time& delete_end, |
| 74 WebDatabase* db); | 74 WebDatabase* db); |
| 75 | 75 |
| 76 // Removes expired form elements recorded for Autocomplete from the database. | |
| 77 WebDatabase::State RemoveExpiredFormElements(WebDatabase* db); | |
| 78 | 76 |
| 79 // Removes the Form-value |value| which has been entered in form input fields | 77 // Removes the Form-value |value| which has been entered in form input fields |
| 80 // named |name| from the database. | 78 // named |name| from the database. |
| 81 WebDatabase::State RemoveFormValueForElementName(const base::string16& name, | 79 WebDatabase::State RemoveFormValueForElementName(const base::string16& name, |
| 82 const base::string16& value, | 80 const base::string16& value, |
| 83 WebDatabase* db); | 81 WebDatabase* db); |
| 84 | 82 |
| 85 // Adds an Autofill profile to the web database. | 83 // Adds an Autofill profile to the web database. |
| 86 WebDatabase::State AddAutofillProfile(const AutofillProfile& profile, | 84 WebDatabase::State AddAutofillProfile(const AutofillProfile& profile, |
| 87 WebDatabase* db); | 85 WebDatabase* db); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 128 |
| 131 private: | 129 private: |
| 132 friend struct content::BrowserThread::DeleteOnThread< | 130 friend struct content::BrowserThread::DeleteOnThread< |
| 133 content::BrowserThread::DB>; | 131 content::BrowserThread::DB>; |
| 134 friend class base::DeleteHelper<AutofillWebDataBackendImpl>; | 132 friend class base::DeleteHelper<AutofillWebDataBackendImpl>; |
| 135 // We have to friend RCTS<> so WIN shared-lib build is happy | 133 // We have to friend RCTS<> so WIN shared-lib build is happy |
| 136 // (http://crbug/112250). | 134 // (http://crbug/112250). |
| 137 friend class base::RefCountedThreadSafe<AutofillWebDataBackendImpl, | 135 friend class base::RefCountedThreadSafe<AutofillWebDataBackendImpl, |
| 138 content::BrowserThread::DeleteOnDBThread>; | 136 content::BrowserThread::DeleteOnDBThread>; |
| 139 | 137 |
| 138 WebDatabase::State RemoveExpiredFormElementsImpl(WebDatabase* db); |
| 139 |
| 140 // Callbacks to ensure that sensitive info is destroyed if request is | 140 // Callbacks to ensure that sensitive info is destroyed if request is |
| 141 // cancelled. | 141 // cancelled. |
| 142 void DestroyAutofillProfileResult(const WDTypedResult* result); | 142 void DestroyAutofillProfileResult(const WDTypedResult* result); |
| 143 void DestroyAutofillCreditCardResult(const WDTypedResult* result); | 143 void DestroyAutofillCreditCardResult(const WDTypedResult* result); |
| 144 | 144 |
| 145 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; | 145 ObserverList<AutofillWebDataServiceObserverOnDBThread> db_observer_list_; |
| 146 | 146 |
| 147 // WebDataServiceBackend allows direct access to DB. | 147 // WebDataServiceBackend allows direct access to DB. |
| 148 // TODO(caitkp): Make it so nobody but us needs direct DB access anymore. | 148 // TODO(caitkp): Make it so nobody but us needs direct DB access anymore. |
| 149 scoped_refptr<WebDataServiceBackend> web_database_backend_; | 149 scoped_refptr<WebDataServiceBackend> web_database_backend_; |
| 150 | 150 |
| 151 base::Closure on_changed_callback_; | 151 base::Closure on_changed_callback_; |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataBackendImpl); | 153 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataBackendImpl); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 } // namespace autofill | 156 } // namespace autofill |
| 157 | 157 |
| 158 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ | 158 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_ |
| OLD | NEW |