OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback_forward.h" |
| 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 |
| 13 class WebDatabase; |
| 14 |
| 15 namespace autofill { |
| 16 |
| 17 class AutofillWebDataBackend; |
| 18 class AutofillWebDataServiceObserverOnDBThread; |
| 19 class AutofillWebDataService; |
| 20 |
| 21 // Delegate class for doing Autofill work directly on the DB thread (used by |
| 22 // Sync, mostly), without fully exposing the AutofillWebDataBackend to clients. |
| 23 class AutofillBackendDelegate { |
| 24 public: |
| 25 AutofillBackendDelegate( |
| 26 base::WeakPtr<WebDatabase> db, |
| 27 base::WeakPtr<AutofillWebDataBackend> autofill_backend); |
| 28 |
| 29 ~AutofillBackendDelegate(); |
| 30 |
| 31 WebDatabase* GetDatabase(); |
| 32 |
| 33 // Add an observer to |autofill_backend_|. |
| 34 void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 35 |
| 36 // Remove an observer from |autofill_backend_|. |
| 37 void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 38 |
| 39 // Remove expired elements from |web_database_| and commit if needed. |
| 40 void RemoveExpiredFormElements(); |
| 41 |
| 42 // Notifies listeners on the UI thread that multiple changes have been made to |
| 43 // to Autofill records of the database. |
| 44 // NOTE: This method is intended to be called from the DB thread. It |
| 45 // it asynchronously notifies listeners on the UI thread. |
| 46 // |web_data_service| may be NULL for testing purposes. |
| 47 void NotifyOfMultipleAutofillChanges( |
| 48 AutofillWebDataService* web_data_service); |
| 49 |
| 50 private: |
| 51 base::WeakPtr<WebDatabase> web_database_; |
| 52 base::WeakPtr<AutofillWebDataBackend> autofill_backend_; |
| 53 |
| 54 }; |
| 55 |
| 56 } // autofill |
| 57 |
| 58 #endif //COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_BACKEND_DELEGATE_H_ |
OLD | NEW |