| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SERVICE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // API for Autofill web data. | 37 // API for Autofill web data. |
| 38 class AutofillWebDataService : public AutofillWebData, | 38 class AutofillWebDataService : public AutofillWebData, |
| 39 public WebDataServiceBase { | 39 public WebDataServiceBase { |
| 40 public: | 40 public: |
| 41 AutofillWebDataService(); | 41 AutofillWebDataService(); |
| 42 | 42 |
| 43 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, | 43 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, |
| 44 const ProfileErrorCallback& callback); | 44 const ProfileErrorCallback& callback); |
| 45 | 45 |
| 46 virtual ~AutofillWebDataService(); |
| 47 |
| 46 // Retrieve an AutofillWebDataService for the given context. | 48 // Retrieve an AutofillWebDataService for the given context. |
| 47 // Can return NULL in some contexts. | 49 // Can return NULL in some contexts. |
| 48 static scoped_refptr<AutofillWebDataService> FromBrowserContext( | 50 static AutofillWebDataService* FromBrowserContext( |
| 49 content::BrowserContext* context); | 51 content::BrowserContext* context); |
| 50 | 52 |
| 51 // WebDataServiceBase implementation. | 53 // WebDataServiceBase implementation. |
| 52 virtual void ShutdownOnUIThread() OVERRIDE; | 54 virtual void ShutdownOnUIThread() OVERRIDE; |
| 53 | 55 |
| 54 // AutofillWebData implementation. | 56 // AutofillWebData implementation. |
| 55 virtual void AddFormFields( | 57 virtual void AddFormFields( |
| 56 const std::vector<FormFieldData>& fields) OVERRIDE; | 58 const std::vector<FormFieldData>& fields) OVERRIDE; |
| 57 virtual WebDataServiceBase::Handle GetFormValuesForElementName( | 59 virtual WebDataServiceBase::Handle GetFormValuesForElementName( |
| 58 const base::string16& name, | 60 const base::string16& name, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // |ShutdownOnUIThread()| is called. | 96 // |ShutdownOnUIThread()| is called. |
| 95 base::SupportsUserData* GetDBUserData(); | 97 base::SupportsUserData* GetDBUserData(); |
| 96 | 98 |
| 97 // Takes a callback which will be called on the DB thread with a pointer to an | 99 // Takes a callback which will be called on the DB thread with a pointer to an |
| 98 // |AutofillWebdataBackend|. This backend can be used to access or update the | 100 // |AutofillWebdataBackend|. This backend can be used to access or update the |
| 99 // WebDatabase directly on the DB thread. | 101 // WebDatabase directly on the DB thread. |
| 100 void GetAutofillBackend( | 102 void GetAutofillBackend( |
| 101 const base::Callback<void(AutofillWebDataBackend*)>& callback); | 103 const base::Callback<void(AutofillWebDataBackend*)>& callback); |
| 102 | 104 |
| 103 protected: | 105 protected: |
| 104 virtual ~AutofillWebDataService(); | |
| 105 | |
| 106 virtual void NotifyAutofillMultipleChangedOnUIThread(); | 106 virtual void NotifyAutofillMultipleChangedOnUIThread(); |
| 107 | 107 |
| 108 base::WeakPtr<AutofillWebDataService> AsWeakPtr() { | 108 base::WeakPtr<AutofillWebDataService> AsWeakPtr() { |
| 109 return weak_ptr_factory_.GetWeakPtr(); | 109 return weak_ptr_factory_.GetWeakPtr(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; | 113 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; |
| 114 | 114 |
| 115 // This factory is used on the UI thread. All vended weak pointers are | 115 // This factory is used on the UI thread. All vended weak pointers are |
| 116 // invalidated in ShutdownOnUIThread(). | 116 // invalidated in ShutdownOnUIThread(). |
| 117 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; | 117 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; |
| 118 | 118 |
| 119 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; | 119 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 121 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace autofill | 124 } // namespace autofill |
| 125 | 125 |
| 126 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 126 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| OLD | NEW |