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

Side by Side Diff: chrome/browser/password_manager/password_store.h

Issue 152683002: Passwords: Remove references to BrowserThread from PasswordStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more tests. Created 6 years, 10 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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_ 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_ 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // PasswordStore::SetObserver. 96 // PasswordStore::SetObserver.
97 class Observer { 97 class Observer {
98 public: 98 public:
99 // Notifies the observer that password data changed in some way. 99 // Notifies the observer that password data changed in some way.
100 virtual void OnLoginsChanged() = 0; 100 virtual void OnLoginsChanged() = 0;
101 101
102 protected: 102 protected:
103 virtual ~Observer() {} 103 virtual ~Observer() {}
104 }; 104 };
105 105
106 PasswordStore(); 106 explicit PasswordStore(
Garrett Casto 2014/02/03 15:56:46 No need for explicit.
Patrick Dubroy 2014/02/03 17:43:25 Whoops, added that when I was initially only passi
107 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
108 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner);
107 109
108 // Reimplement this to add custom initialization. Always call this too. 110 // Reimplement this to add custom initialization. Always call this too.
109 virtual bool Init(); 111 virtual bool Init();
110 112
111 // Adds the given PasswordForm to the secure password store asynchronously. 113 // Adds the given PasswordForm to the secure password store asynchronously.
112 virtual void AddLogin(const autofill::PasswordForm& form); 114 virtual void AddLogin(const autofill::PasswordForm& form);
113 115
114 // Updates the matching PasswordForm in the secure password store (async). 116 // Updates the matching PasswordForm in the secure password store (async).
115 void UpdateLogin(const autofill::PasswordForm& form); 117 void UpdateLogin(const autofill::PasswordForm& form);
116 118
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 friend void passwords_helper::RemoveLogin(PasswordStore*, 170 friend void passwords_helper::RemoveLogin(PasswordStore*,
169 const autofill::PasswordForm&); 171 const autofill::PasswordForm&);
170 friend void passwords_helper::UpdateLogin(PasswordStore*, 172 friend void passwords_helper::UpdateLogin(PasswordStore*,
171 const autofill::PasswordForm&); 173 const autofill::PasswordForm&);
172 174
173 virtual ~PasswordStore(); 175 virtual ~PasswordStore();
174 176
175 // Schedules the given |task| to be run on the PasswordStore's TaskRunner. 177 // Schedules the given |task| to be run on the PasswordStore's TaskRunner.
176 bool ScheduleTask(const base::Closure& task); 178 bool ScheduleTask(const base::Closure& task);
177 179
178 // Get the TaskRunner to use for PasswordStore tasks. 180 // Get the TaskRunner to use for PasswordStore background tasks.
179 // By default, a SingleThreadTaskRunner on the DB thread is used, but 181 // By default, a SingleThreadTaskRunner on the DB thread is used, but
180 // subclasses can override. 182 // subclasses can override.
181 virtual scoped_refptr<base::SequencedTaskRunner> GetTaskRunner(); 183 virtual scoped_refptr<base::SequencedTaskRunner> GetBackgroundTaskRunner();
182 184
183 // These will be run in PasswordStore's own thread. 185 // These will be run in PasswordStore's own thread.
184 // Synchronous implementation that reports usage metrics. 186 // Synchronous implementation that reports usage metrics.
185 virtual void ReportMetricsImpl() = 0; 187 virtual void ReportMetricsImpl() = 0;
186 // Synchronous implementation to add the given login. 188 // Synchronous implementation to add the given login.
187 virtual void AddLoginImpl(const autofill::PasswordForm& form) = 0; 189 virtual void AddLoginImpl(const autofill::PasswordForm& form) = 0;
188 // Synchronous implementation to update the given login. 190 // Synchronous implementation to update the given login.
189 virtual void UpdateLoginImpl(const autofill::PasswordForm& form) = 0; 191 virtual void UpdateLoginImpl(const autofill::PasswordForm& form) = 0;
190 // Synchronous implementation to remove the given login. 192 // Synchronous implementation to remove the given login.
191 virtual void RemoveLoginImpl(const autofill::PasswordForm& form) = 0; 193 virtual void RemoveLoginImpl(const autofill::PasswordForm& form) = 0;
(...skipping 26 matching lines...) Expand all
218 virtual bool FillBlacklistLogins( 220 virtual bool FillBlacklistLogins(
219 std::vector<autofill::PasswordForm*>* forms) = 0; 221 std::vector<autofill::PasswordForm*>* forms) = 0;
220 222
221 // Dispatches the result to the PasswordStoreConsumer on the original caller's 223 // Dispatches the result to the PasswordStoreConsumer on the original caller's
222 // thread so the callback can be executed there. This should be the UI thread. 224 // thread so the callback can be executed there. This should be the UI thread.
223 virtual void ForwardLoginsResult(GetLoginsRequest* request); 225 virtual void ForwardLoginsResult(GetLoginsRequest* request);
224 226
225 // Log UMA stats for number of bulk deletions. 227 // Log UMA stats for number of bulk deletions.
226 void LogStatsForBulkDeletion(int num_deletions); 228 void LogStatsForBulkDeletion(int num_deletions);
227 229
230 // TaskRunner for tasks that run on the main PasswordStore thread (usually
Garrett Casto 2014/02/03 15:56:46 How about just "main thread" instead of "main Pass
Patrick Dubroy 2014/02/03 17:43:25 Done.
Patrick Dubroy 2014/02/03 17:43:25 Done.
231 // the UI thread).
232 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
Garrett Casto 2014/02/03 15:56:46 Not sure if I think that this is the right name. m
Patrick Dubroy 2014/02/03 17:43:25 Done.
233
234 // TaskRunner for the DB thread. By default, this is the task runner used for
235 // background tasks -- see |GetBackgroundTaskRunner|.
236 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner_;
237
228 private: 238 private:
229 // Schedule the given |func| to be run in the PasswordStore's own thread with 239 // Schedule the given |func| to be run in the PasswordStore's own thread with
230 // responses delivered to |consumer| on the current thread. 240 // responses delivered to |consumer| on the current thread.
231 template<typename BackendFunc> 241 template<typename BackendFunc>
232 void Schedule(BackendFunc func, PasswordStoreConsumer* consumer); 242 void Schedule(BackendFunc func, PasswordStoreConsumer* consumer);
233 243
234 // Wrapper method called on the destination thread (DB for non-mac) that 244 // Wrapper method called on the destination thread (DB for non-mac) that
235 // invokes |task| and then calls back into the source thread to notify 245 // invokes |task| and then calls back into the source thread to notify
236 // observers that the password store may have been modified via 246 // observers that the password store may have been modified via
237 // NotifyLoginsChanged(). Note that there is no guarantee that the called 247 // NotifyLoginsChanged(). Note that there is no guarantee that the called
(...skipping 19 matching lines...) Expand all
257 PasswordStore::GetLoginsRequest* request, 267 PasswordStore::GetLoginsRequest* request,
258 const std::vector<autofill::PasswordForm*>& matched_forms); 268 const std::vector<autofill::PasswordForm*>& matched_forms);
259 269
260 // The observers. 270 // The observers.
261 ObserverList<Observer> observers_; 271 ObserverList<Observer> observers_;
262 272
263 DISALLOW_COPY_AND_ASSIGN(PasswordStore); 273 DISALLOW_COPY_AND_ASSIGN(PasswordStore);
264 }; 274 };
265 275
266 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_ 276 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698