OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Interface for storing form passwords in a platform-specific secure way. | 28 // Interface for storing form passwords in a platform-specific secure way. |
29 // The login request/manipulation API is not threadsafe. | 29 // The login request/manipulation API is not threadsafe. |
30 class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { | 30 class PasswordStore : public base::RefCountedThreadSafe<PasswordStore> { |
31 public: | 31 public: |
32 PasswordStore(); | 32 PasswordStore(); |
33 virtual ~PasswordStore() {} | 33 virtual ~PasswordStore() {} |
34 | 34 |
35 // Reimplement this to add custom initialization. Always call this too. | 35 // Reimplement this to add custom initialization. Always call this too. |
36 virtual bool Init(); | 36 virtual bool Init(); |
37 | 37 |
| 38 // TODO(stuartmorgan): These are only virtual to support the shim version of |
| 39 // password_store_default; once that is fixed, they can become non-virtual. |
| 40 |
38 // Adds the given PasswordForm to the secure password store asynchronously. | 41 // Adds the given PasswordForm to the secure password store asynchronously. |
39 void AddLogin(const PasswordForm& form); | 42 virtual void AddLogin(const PasswordForm& form); |
40 // Updates the matching PasswordForm in the secure password store (async). | 43 // Updates the matching PasswordForm in the secure password store (async). |
41 void UpdateLogin(const PasswordForm& form); | 44 virtual void UpdateLogin(const PasswordForm& form); |
42 // Removes the matching PasswordForm from the secure password store (async). | 45 // Removes the matching PasswordForm from the secure password store (async). |
43 void RemoveLogin(const PasswordForm& form); | 46 virtual void RemoveLogin(const PasswordForm& form); |
44 // Searches for a matching PasswordForm and returns a handle so the async | 47 // Searches for a matching PasswordForm and returns a handle so the async |
45 // request can be tracked. Implement the PasswordStoreConsumer interface to | 48 // request can be tracked. Implement the PasswordStoreConsumer interface to |
46 // be notified on completion. | 49 // be notified on completion. |
47 int GetLogins(const PasswordForm& form, | 50 virtual int GetLogins(const PasswordForm& form, |
48 PasswordStoreConsumer* consumer); | 51 PasswordStoreConsumer* consumer); |
49 | 52 |
50 // Cancels a previous GetLogins query (async) | 53 // Cancels a previous GetLogins query (async) |
51 virtual void CancelLoginsQuery(int handle); | 54 virtual void CancelLoginsQuery(int handle); |
52 | 55 |
53 protected: | 56 protected: |
54 // Simple container class that represents a GetLogins request. | 57 // Simple container class that represents a GetLogins request. |
55 // Created in GetLogins and passed to GetLoginsImpl. | 58 // Created in GetLogins and passed to GetLoginsImpl. |
56 struct GetLoginsRequest { | 59 struct GetLoginsRequest { |
57 GetLoginsRequest(const PasswordForm& f, | 60 GetLoginsRequest(const PasswordForm& f, |
58 PasswordStoreConsumer* c, | 61 PasswordStoreConsumer* c, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const std::vector<PasswordForm*> forms); | 109 const std::vector<PasswordForm*> forms); |
107 | 110 |
108 // List of pending request handles. Handles are removed from the set when | 111 // List of pending request handles. Handles are removed from the set when |
109 // they finish or are canceled. | 112 // they finish or are canceled. |
110 std::set<int> pending_requests_; | 113 std::set<int> pending_requests_; |
111 | 114 |
112 DISALLOW_COPY_AND_ASSIGN(PasswordStore); | 115 DISALLOW_COPY_AND_ASSIGN(PasswordStore); |
113 }; | 116 }; |
114 | 117 |
115 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE | 118 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE |
OLD | NEW |