Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: components/autofill/browser/webdata/autofill_webdata_service.h

Issue 14679005: Create an AutofillBackend interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert delegate to interface Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/memory/weak_ptr.h"
11 #include "base/observer_list.h" 12 #include "base/observer_list.h"
12 #include "base/supports_user_data.h" 13 #include "base/supports_user_data.h"
13 #include "components/autofill/browser/webdata/autofill_webdata.h" 14 #include "components/autofill/browser/webdata/autofill_webdata.h"
14 #include "components/autofill/common/form_field_data.h" 15 #include "components/autofill/common/form_field_data.h"
15 #include "components/webdata/common/web_data_results.h" 16 #include "components/webdata/common/web_data_results.h"
16 #include "components/webdata/common/web_data_service_base.h" 17 #include "components/webdata/common/web_data_service_base.h"
17 #include "components/webdata/common/web_data_service_consumer.h" 18 #include "components/webdata/common/web_data_service_consumer.h"
18 #include "components/webdata/common/web_database.h" 19 #include "components/webdata/common/web_database.h"
19 20
20 class WebDatabaseService; 21 class WebDatabaseService;
21 22
22 namespace content { 23 namespace content {
23 class BrowserContext; 24 class BrowserContext;
24 } 25 }
25 26
26 namespace autofill { 27 namespace autofill {
27 28
28 class AutofillChange; 29 class AutofillChange;
29 class AutofillProfile; 30 class AutofillProfile;
30 class AutofillWebDataBackend; 31 class AutofillWebDataBackend;
31 class AutofillWebDataServiceObserverOnDBThread; 32 class AutofillWebDataServiceObserverOnDBThread;
32 class AutofillWebDataServiceObserverOnUIThread; 33 class AutofillWebDataServiceObserverOnUIThread;
33 class CreditCard; 34 class CreditCard;
35 class SyncableServiceBackend;
34 36
35 // API for Autofill web data. 37 // API for Autofill web data.
36 class AutofillWebDataService : public AutofillWebData, 38 class AutofillWebDataService : public AutofillWebData,
37 public WebDataServiceBase { 39 public WebDataServiceBase {
38 public: 40 public:
39 AutofillWebDataService(); 41 AutofillWebDataService();
40 42
41 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs, 43 AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs,
42 const ProfileErrorCallback& callback); 44 const ProfileErrorCallback& callback);
43 45
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 91
90 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer); 92 void AddObserver(AutofillWebDataServiceObserverOnUIThread* observer);
91 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer); 93 void RemoveObserver(AutofillWebDataServiceObserverOnUIThread* observer);
92 94
93 // Returns a SupportsUserData objects that may be used to store data 95 // Returns a SupportsUserData objects that may be used to store data
94 // owned by the DB thread on this object. Should be called only from 96 // owned by the DB thread on this object. Should be called only from
95 // the DB thread, and will be destroyed on the DB thread soon after 97 // the DB thread, and will be destroyed on the DB thread soon after
96 // |ShutdownOnUIThread()| is called. 98 // |ShutdownOnUIThread()| is called.
97 base::SupportsUserData* GetDBUserData(); 99 base::SupportsUserData* GetDBUserData();
98 100
101 void GetSyncableBackend(
Jói 2013/05/07 19:39:41 Needs documentation.
Cait (Slow) 2013/05/07 20:14:56 Done.
102 const base::Callback<void(SyncableServiceBackend*)>& callback);
99 protected: 103 protected:
100 virtual ~AutofillWebDataService(); 104 virtual ~AutofillWebDataService();
101 105
102 virtual void ShutdownOnDBThread(); 106 virtual void ShutdownOnDBThread();
103 107
108 // This factory is used on the UIThread. All vended weak pointers are
109 // invalidated in ShutdownOnUIThread().
110 base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_;
111
104 private: 112 private:
105 // This makes the destructor public, and thus allows us to aggregate 113 // This makes the destructor public, and thus allows us to aggregate
106 // SupportsUserData. It is private by default to prevent incorrect 114 // SupportsUserData. It is private by default to prevent incorrect
107 // usage in class hierarchies where it is inherited by 115 // usage in class hierarchies where it is inherited by
108 // reference-counted objects. 116 // reference-counted objects.
109 class SupportsUserDataAggregatable : public base::SupportsUserData { 117 class SupportsUserDataAggregatable : public base::SupportsUserData {
110 public: 118 public:
111 SupportsUserDataAggregatable() {} 119 SupportsUserDataAggregatable() {}
112 virtual ~SupportsUserDataAggregatable() {} 120 virtual ~SupportsUserDataAggregatable() {}
113 private: 121 private:
(...skipping 10 matching lines...) Expand all
124 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_; 132 ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_;
125 133
126 scoped_refptr<AutofillWebDataBackend> autofill_backend_; 134 scoped_refptr<AutofillWebDataBackend> autofill_backend_;
127 135
128 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService); 136 DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService);
129 }; 137 };
130 138
131 } // namespace autofill 139 } // namespace autofill
132 140
133 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_ 141 #endif // COMPONENTS_AUTOFILL_BROWSER_WEBDATA_AUTOFILL_WEBDATA_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698