Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 WebDataServiceConsumer* consumer) OVERRIDE; | 88 WebDataServiceConsumer* consumer) OVERRIDE; |
| 89 virtual void RemoveAutofillDataModifiedBetween( | 89 virtual void RemoveAutofillDataModifiedBetween( |
| 90 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 90 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; |
| 91 | 91 |
| 92 void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); | 92 void AddObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 93 void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); | 93 void RemoveObserver(AutofillWebDataServiceObserverOnDBThread* observer); |
| 94 | 94 |
| 95 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); | 95 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); |
| 96 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); | 96 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); |
| 97 | 97 |
| 98 void NotifyAutofillMultipleChangedOnUIThread(); | |
|
Ilya Sherman
2013/05/13 23:44:47
nit: Why did you change the visibility of this met
Cait (Slow)
2013/05/14 22:30:08
This method is passed to the backend as a callback
| |
| 99 | |
| 98 // Returns a SupportsUserData objects that may be used to store data | 100 // Returns a SupportsUserData objects that may be used to store data |
| 99 // owned by the DB thread on this object. Should be called only from | 101 // owned by the DB thread on this object. Should be called only from |
| 100 // the DB thread, and will be destroyed on the DB thread soon after | 102 // the DB thread, and will be destroyed on the DB thread soon after |
| 101 // |ShutdownOnUIThread()| is called. | 103 // |ShutdownOnUIThread()| is called. |
| 102 base::SupportsUserData* GetDBUserData(); | 104 base::SupportsUserData* GetDBUserData(); |
| 103 | 105 |
| 104 // Takes a callback which will be called on the DB thread with a pointer to an | 106 // Takes a callback which will be called on the DB thread with a pointer to an |
| 105 // |AutofillWebdataBackend|. This backend can be used to access or update the | 107 // |AutofillWebdataBackend|. This backend can be used to access or update the |
| 106 // WebDatabase directly on the DB thread. | 108 // WebDatabase directly on the DB thread. |
| 107 void GetAutofillBackend( | 109 void GetAutofillBackend( |
| 108 const base::Callback<void(AutofillWebDataBackend*)>& callback); | 110 const base::Callback<void(AutofillWebDataBackend*)>& callback); |
| 109 | 111 |
| 110 protected: | 112 protected: |
| 111 virtual ~AutofillWebDataService(); | 113 virtual ~AutofillWebDataService(); |
| 112 | 114 |
| 113 virtual void ShutdownOnDBThread(); | 115 virtual void ShutdownOnDBThread(); |
| 114 | 116 |
| 117 base::WeakPtr<AutofillWebDataService> AsWeakPtr() { | |
| 118 return weak_ptr_factory_.GetWeakPtr(); | |
| 119 } | |
| 120 | |
| 115 private: | 121 private: |
| 116 // This makes the destructor public, and thus allows us to aggregate | 122 // This makes the destructor public, and thus allows us to aggregate |
| 117 // SupportsUserData. It is private by default to prevent incorrect | 123 // SupportsUserData. It is private by default to prevent incorrect |
| 118 // usage in class hierarchies where it is inherited by | 124 // usage in class hierarchies where it is inherited by |
| 119 // reference-counted objects. | 125 // reference-counted objects. |
| 120 class SupportsUserDataAggregatable : public base::SupportsUserData { | 126 class SupportsUserDataAggregatable : public base::SupportsUserData { |
| 121 public: | 127 public: |
| 122 SupportsUserDataAggregatable() {} | 128 SupportsUserDataAggregatable() {} |
| 123 virtual ~SupportsUserDataAggregatable() {} | 129 virtual ~SupportsUserDataAggregatable() {} |
| 124 private: | 130 private: |
| 125 DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable); | 131 DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable); |
| 126 }; | 132 }; |
| 127 | 133 |
| 128 void NotifyAutofillMultipleChangedOnUIThread(); | |
| 129 | |
| 130 // Storage for user data to be accessed only on the DB thread. May | 134 // Storage for user data to be accessed only on the DB thread. May |
| 131 // be used e.g. for SyncableService subclasses that need to be owned | 135 // be used e.g. for SyncableService subclasses that need to be owned |
| 132 // by this object. Is created on first call to |GetDBUserData()|. | 136 // by this object. Is created on first call to |GetDBUserData()|. |
| 133 scoped_ptr<SupportsUserDataAggregatable> db_thread_user_data_; | 137 scoped_ptr<SupportsUserDataAggregatable> db_thread_user_data_; |
| 134 | 138 |
| 135 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; | 139 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; |
| 136 | 140 |
| 137 // This factory is used on the UI thread. All vended weak pointers are | 141 // This factory is used on the UI thread. All vended weak pointers are |
| 138 // invalidated in ShutdownOnUIThread(). | 142 // invalidated in ShutdownOnUIThread(). |
| 139 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; | 143 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_; |
| 140 | 144 |
| 141 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; | 145 scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_; |
| 142 | 146 |
| 143 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); | 147 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 } // namespace autofill | 150 } // namespace autofill |
| 147 | 151 |
| 148 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ | 152 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ |
| OLD | NEW |