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

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

Issue 10209036: Per bug 121738, ignore old saved logins for http*://www.google.com. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 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 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 : public RefcountedProfileKeyedService, 45 : public RefcountedProfileKeyedService,
46 public CancelableRequestProvider { 46 public CancelableRequestProvider {
47 public: 47 public:
48 typedef base::Callback< 48 typedef base::Callback<
49 void(Handle, const std::vector<webkit::forms::PasswordForm*>&)> 49 void(Handle, const std::vector<webkit::forms::PasswordForm*>&)>
50 GetLoginsCallback; 50 GetLoginsCallback;
51 51
52 // PasswordForm vector elements are meant to be owned by the 52 // PasswordForm vector elements are meant to be owned by the
53 // PasswordStoreConsumer. However, if the request is canceled after the 53 // PasswordStoreConsumer. However, if the request is canceled after the
54 // allocation, then the request must take care of the deletion. 54 // allocation, then the request must take care of the deletion.
55 // TODO(scr) If we can convert vector<PasswordForm*> to
56 // ScopedVector<PasswordForm>, then we can move the following class to merely
57 // a typedef. At the moment, a subclass of CancelableRequest1 is required to
58 // provide a destructor, which cleans up after canceled requests by deleting
59 // vector elements.
60 class GetLoginsRequest 55 class GetLoginsRequest
61 : public CancelableRequest1<GetLoginsCallback, 56 : public CancelableRequest1<GetLoginsCallback,
62 std::vector<webkit::forms::PasswordForm*> > { 57 std::vector<webkit::forms::PasswordForm*> > {
63 public: 58 public:
64 explicit GetLoginsRequest(const GetLoginsCallback& callback); 59 explicit GetLoginsRequest(const GetLoginsCallback& callback);
65 60
61 void set_ignore_logins_cutoff(time_t cutoff) {
62 ignore_logins_cutoff_ = cutoff;
63 }
64
65 // Removes any logins in the result list that were saved before the cutoff.
66 void ApplyIgnoreLoginsCutoff();
67
66 protected: 68 protected:
67 virtual ~GetLoginsRequest(); 69 virtual ~GetLoginsRequest();
68 70
69 private: 71 private:
72 // See GetLogins(). Logins older than this will be removed from the reply.
73 time_t ignore_logins_cutoff_;
74
70 DISALLOW_COPY_AND_ASSIGN(GetLoginsRequest); 75 DISALLOW_COPY_AND_ASSIGN(GetLoginsRequest);
71 }; 76 };
72 77
73 // An interface used to notify clients (observers) of this object that data in 78 // An interface used to notify clients (observers) of this object that data in
74 // the password store has changed. Register the observer via 79 // the password store has changed. Register the observer via
75 // PasswordStore::SetObserver. 80 // PasswordStore::SetObserver.
76 class Observer { 81 class Observer {
77 public: 82 public:
78 // Notifies the observer that password data changed in some way. 83 // Notifies the observer that password data changed in some way.
79 virtual void OnLoginsChanged() = 0; 84 virtual void OnLoginsChanged() = 0;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 std::vector<webkit::forms::PasswordForm*>* forms) = 0; 180 std::vector<webkit::forms::PasswordForm*>* forms) = 0;
176 // Finds all blacklist PasswordForms, and fills the vector. 181 // Finds all blacklist PasswordForms, and fills the vector.
177 virtual bool FillBlacklistLogins( 182 virtual bool FillBlacklistLogins(
178 std::vector<webkit::forms::PasswordForm*>* forms) = 0; 183 std::vector<webkit::forms::PasswordForm*>* forms) = 0;
179 184
180 // Dispatches the result to the PasswordStoreConsumer on the original caller's 185 // Dispatches the result to the PasswordStoreConsumer on the original caller's
181 // thread so the callback can be executed there. This should be the UI 186 // thread so the callback can be executed there. This should be the UI
182 // thread. 187 // thread.
183 virtual void ForwardLoginsResult(GetLoginsRequest* request); 188 virtual void ForwardLoginsResult(GetLoginsRequest* request);
184 189
190 private:
185 // Schedule the given |func| to be run in the PasswordStore's own thread with 191 // Schedule the given |func| to be run in the PasswordStore's own thread with
186 // responses delivered to |consumer| on the current thread. 192 // responses delivered to |consumer| on the current thread.
187 template<typename BackendFunc> 193 template<typename BackendFunc>
188 Handle Schedule(BackendFunc func, PasswordStoreConsumer* consumer); 194 Handle Schedule(BackendFunc func, PasswordStoreConsumer* consumer);
189 195
190 // Schedule the given |func| to be run in the PasswordStore's own thread with 196 // Schedule the given |func| to be run in the PasswordStore's own thread with
191 // argument |a| and responses delivered to |consumer| on the current thread. 197 // form |form| and responses delivered to |consumer| on the current thread.
192 template<typename BackendFunc, typename ArgA> 198 // See GetLogins() for more information on |ignore_logins_cutoff|.
199 template<typename BackendFunc>
193 Handle Schedule(BackendFunc func, PasswordStoreConsumer* consumer, 200 Handle Schedule(BackendFunc func, PasswordStoreConsumer* consumer,
194 const ArgA& a); 201 const webkit::forms::PasswordForm& form,
202 time_t ignore_logins_cutoff);
195 203
196 private:
197 // Wrapper method called on the destination thread (DB for non-mac) that 204 // Wrapper method called on the destination thread (DB for non-mac) that
198 // invokes |task| and then calls back into the source thread to notify 205 // invokes |task| and then calls back into the source thread to notify
199 // observers that the password store may have been modified via 206 // observers that the password store may have been modified via
200 // NotifyLoginsChanged(). Note that there is no guarantee that the called 207 // NotifyLoginsChanged(). Note that there is no guarantee that the called
201 // method will actually modify the password store data. 208 // method will actually modify the password store data.
202 void WrapModificationTask(base::Closure task); 209 void WrapModificationTask(base::Closure task);
203 210
204 // Post a message to the UI thread to run NotifyLoginsChanged(). Called by 211 // Post a message to the UI thread to run NotifyLoginsChanged(). Called by
205 // WrapModificationTask() above, and split out as a separate method so that 212 // WrapModificationTask() above, and split out as a separate method so that
206 // password sync can call it as well after synchronously updating the password 213 // password sync can call it as well after synchronously updating the password
207 // store. 214 // store.
208 void PostNotifyLoginsChanged(); 215 void PostNotifyLoginsChanged();
209 216
210 // Called by WrapModificationTask() once the underlying data-modifying 217 // Called by WrapModificationTask() once the underlying data-modifying
211 // operation has been performed. Notifies observers that password store data 218 // operation has been performed. Notifies observers that password store data
212 // may have been changed. 219 // may have been changed.
213 void NotifyLoginsChanged(); 220 void NotifyLoginsChanged();
214 221
215 // The observers. 222 // The observers.
216 ObserverList<Observer> observers_; 223 ObserverList<Observer> observers_;
217 224
218 DISALLOW_COPY_AND_ASSIGN(PasswordStore); 225 DISALLOW_COPY_AND_ASSIGN(PasswordStore);
219 }; 226 };
220 227
221 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_ 228 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_store.cc » ('j') | chrome/browser/password_manager/password_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698