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

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

Issue 99303009: Merge 241255 "[Mac] Passwords: Don't always prompt to access pas..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 7 years 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // The login request/manipulation API is not threadsafe and must be used 42 // The login request/manipulation API is not threadsafe and must be used
43 // from the UI thread. 43 // from the UI thread.
44 class PasswordStore 44 class PasswordStore
45 : public RefcountedBrowserContextKeyedService, 45 : public RefcountedBrowserContextKeyedService,
46 public CancelableRequestProvider { 46 public CancelableRequestProvider {
47 public: 47 public:
48 typedef base::Callback< 48 typedef base::Callback<
49 void(Handle, const std::vector<autofill::PasswordForm*>&)> 49 void(Handle, const std::vector<autofill::PasswordForm*>&)>
50 GetLoginsCallback; 50 GetLoginsCallback;
51 51
52 // Whether or not it's acceptable for Chrome to request access to locked
53 // passwords, which requires prompting the user for permission.
54 enum AuthorizationPromptPolicy {
55 ALLOW_PROMPT,
56 DISALLOW_PROMPT
57 };
58
52 // PasswordForm vector elements are meant to be owned by the 59 // PasswordForm vector elements are meant to be owned by the
53 // PasswordStoreConsumer. However, if the request is canceled after the 60 // PasswordStoreConsumer. However, if the request is canceled after the
54 // allocation, then the request must take care of the deletion. 61 // allocation, then the request must take care of the deletion.
55 class GetLoginsRequest 62 class GetLoginsRequest
56 : public CancelableRequest1<GetLoginsCallback, 63 : public CancelableRequest1<GetLoginsCallback,
57 std::vector<autofill::PasswordForm*> > { 64 std::vector<autofill::PasswordForm*> > {
58 public: 65 public:
59 explicit GetLoginsRequest(const GetLoginsCallback& callback); 66 explicit GetLoginsRequest(const GetLoginsCallback& callback);
60 67
61 void set_ignore_logins_cutoff(const base::Time& cutoff) { 68 void set_ignore_logins_cutoff(const base::Time& cutoff) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 107
101 // Removes the matching PasswordForm from the secure password store (async). 108 // Removes the matching PasswordForm from the secure password store (async).
102 void RemoveLogin(const autofill::PasswordForm& form); 109 void RemoveLogin(const autofill::PasswordForm& form);
103 110
104 // Removes all logins created in the given date range. 111 // Removes all logins created in the given date range.
105 void RemoveLoginsCreatedBetween(const base::Time& delete_begin, 112 void RemoveLoginsCreatedBetween(const base::Time& delete_begin,
106 const base::Time& delete_end); 113 const base::Time& delete_end);
107 114
108 // Searches for a matching PasswordForm and returns a ID so the async request 115 // Searches for a matching PasswordForm and returns a ID so the async request
109 // can be tracked. Implement the PasswordStoreConsumer interface to be 116 // can be tracked. Implement the PasswordStoreConsumer interface to be
110 // notified on completion. 117 // notified on completion. |prompt_policy| indicates whether it's permissible
118 // to prompt the user to authorize access to locked passwords. This argument
119 // is only used on platforms that support prompting the user for access (such
120 // as Mac OS). NOTE: This means that this method can return different results
121 // depending on the value of |prompt_policy|.
111 virtual CancelableTaskTracker::TaskId GetLogins( 122 virtual CancelableTaskTracker::TaskId GetLogins(
112 const autofill::PasswordForm& form, 123 const autofill::PasswordForm& form,
124 AuthorizationPromptPolicy prompt_policy,
113 PasswordStoreConsumer* consumer); 125 PasswordStoreConsumer* consumer);
114 126
115 // Gets the complete list of PasswordForms that are not blacklist entries--and 127 // Gets the complete list of PasswordForms that are not blacklist entries--and
116 // are thus auto-fillable--and returns a handle so the async request can be 128 // are thus auto-fillable--and returns a handle so the async request can be
117 // tracked. Implement the PasswordStoreConsumer interface to be notified on 129 // tracked. Implement the PasswordStoreConsumer interface to be notified on
118 // completion. 130 // completion.
119 Handle GetAutofillableLogins(PasswordStoreConsumer* consumer); 131 Handle GetAutofillableLogins(PasswordStoreConsumer* consumer);
120 132
121 // Gets the complete list of PasswordForms that are blacklist entries, and 133 // Gets the complete list of PasswordForms that are blacklist entries, and
122 // returns a handle so the async request can be tracked. Implement the 134 // returns a handle so the async request can be tracked. Implement the
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const base::Time& delete_end) = 0; 188 const base::Time& delete_end) = 0;
177 189
178 typedef base::Callback<void(const std::vector<autofill::PasswordForm*>&)> 190 typedef base::Callback<void(const std::vector<autofill::PasswordForm*>&)>
179 ConsumerCallbackRunner; // Owns all PasswordForms in the vector. 191 ConsumerCallbackRunner; // Owns all PasswordForms in the vector.
180 192
181 // Should find all PasswordForms with the same signon_realm. The results 193 // Should find all PasswordForms with the same signon_realm. The results
182 // will then be scored by the PasswordFormManager. Once they are found 194 // will then be scored by the PasswordFormManager. Once they are found
183 // (or not), the consumer should be notified. 195 // (or not), the consumer should be notified.
184 virtual void GetLoginsImpl( 196 virtual void GetLoginsImpl(
185 const autofill::PasswordForm& form, 197 const autofill::PasswordForm& form,
198 AuthorizationPromptPolicy prompt_policy,
186 const ConsumerCallbackRunner& callback_runner) = 0; 199 const ConsumerCallbackRunner& callback_runner) = 0;
187 200
188 // Finds all non-blacklist PasswordForms, and notifies the consumer. 201 // Finds all non-blacklist PasswordForms, and notifies the consumer.
189 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) = 0; 202 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) = 0;
190 // Finds all blacklist PasswordForms, and notifies the consumer. 203 // Finds all blacklist PasswordForms, and notifies the consumer.
191 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) = 0; 204 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) = 0;
192 205
193 // Finds all non-blacklist PasswordForms, and fills the vector. 206 // Finds all non-blacklist PasswordForms, and fills the vector.
194 virtual bool FillAutofillableLogins( 207 virtual bool FillAutofillableLogins(
195 std::vector<autofill::PasswordForm*>* forms) = 0; 208 std::vector<autofill::PasswordForm*>* forms) = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // may have been changed. 250 // may have been changed.
238 void NotifyLoginsChanged(); 251 void NotifyLoginsChanged();
239 252
240 // The observers. 253 // The observers.
241 ObserverList<Observer> observers_; 254 ObserverList<Observer> observers_;
242 255
243 DISALLOW_COPY_AND_ASSIGN(PasswordStore); 256 DISALLOW_COPY_AND_ASSIGN(PasswordStore);
244 }; 257 };
245 258
246 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_ 259 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_manager_unittest.cc ('k') | chrome/browser/password_manager/password_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698