OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GNOME_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
7 | 7 |
8 extern "C" { | 8 extern "C" { |
9 #include <gnome-keyring.h> | 9 #include <gnome-keyring.h> |
10 } | 10 } |
11 | 11 |
| 12 #include <vector> |
| 13 |
12 #include "base/lock.h" | 14 #include "base/lock.h" |
| 15 #include "chrome/browser/password_manager/login_database.h" |
13 #include "chrome/browser/password_manager/password_store.h" | 16 #include "chrome/browser/password_manager/password_store.h" |
| 17 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/webdata/web_data_service.h" |
14 | 19 |
15 class Profile; | 20 class Profile; |
16 class Task; | 21 class Task; |
17 | 22 |
18 // PasswordStore implementation using Gnome Keyring. | 23 // PasswordStore implementation using GNOME Keyring. |
19 class PasswordStoreGnome : public PasswordStore { | 24 class PasswordStoreGnome : public PasswordStore { |
20 public: | 25 public: |
21 PasswordStoreGnome(); | 26 PasswordStoreGnome(LoginDatabase* login_db, |
| 27 Profile* profile, |
| 28 WebDataService* web_data_service); |
22 | 29 |
23 virtual bool Init(); | 30 virtual bool Init(); |
24 | 31 |
25 private: | 32 private: |
26 virtual ~PasswordStoreGnome(); | 33 virtual ~PasswordStoreGnome(); |
27 | 34 |
28 void AddLoginImpl(const PasswordForm& form); | 35 // Implements PasswordStore interface. |
29 void UpdateLoginImpl(const PasswordForm& form); | 36 virtual void AddLoginImpl(const webkit_glue::PasswordForm& form); |
30 void RemoveLoginImpl(const PasswordForm& form); | 37 virtual void UpdateLoginImpl(const webkit_glue::PasswordForm& form); |
31 void GetLoginsImpl(GetLoginsRequest* request); | 38 virtual void RemoveLoginImpl(const webkit_glue::PasswordForm& form); |
| 39 virtual void RemoveLoginsCreatedBetweenImpl(const base::Time& delete_begin, |
| 40 const base::Time& delete_end); |
| 41 virtual void GetLoginsImpl(GetLoginsRequest* request, |
| 42 const webkit_glue::PasswordForm& form); |
| 43 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request); |
| 44 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request); |
| 45 virtual bool FillAutofillableLogins( |
| 46 std::vector<webkit_glue::PasswordForm*>* forms); |
| 47 virtual bool FillBlacklistLogins( |
| 48 std::vector<webkit_glue::PasswordForm*>* forms); |
| 49 |
| 50 // Helper for AddLoginImpl() and UpdateLoginImpl() with a success status. |
| 51 bool AddLoginHelper(const webkit_glue::PasswordForm& form, |
| 52 const base::Time& date_created); |
| 53 |
| 54 // Helper for FillAutofillableLogins() and FillBlacklistLogins(). |
| 55 bool FillSomeLogins(bool autofillable, |
| 56 std::vector<webkit_glue::PasswordForm*>* forms); |
| 57 |
| 58 // Parse all the results from the given GList into a |
| 59 // vector<PasswordForm*>, and free the GList. PasswordForms are |
| 60 // allocated on the heap, and should be deleted by the consumer. |
| 61 void FillFormVector(GList* found, |
| 62 std::vector<webkit_glue::PasswordForm*>* forms); |
32 | 63 |
33 static const GnomeKeyringPasswordSchema kGnomeSchema; | 64 static const GnomeKeyringPasswordSchema kGnomeSchema; |
34 | 65 |
35 // Mutex for all interactions with Gnome Keyring. | |
36 Lock gnome_keyring_lock_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(PasswordStoreGnome); | 66 DISALLOW_COPY_AND_ASSIGN(PasswordStoreGnome); |
39 }; | 67 }; |
40 | 68 |
41 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ | 69 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_GNOME_H_ |
OLD | NEW |