| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_X_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // login database like PasswordStoreDefault. It also handles automatically | 23 // login database like PasswordStoreDefault. It also handles automatically |
| 24 // migrating password data to a native backend from the login database. | 24 // migrating password data to a native backend from the login database. |
| 25 // | 25 // |
| 26 // There are currently native backends for GNOME Keyring and KWallet. | 26 // There are currently native backends for GNOME Keyring and KWallet. |
| 27 class PasswordStoreX : public PasswordStoreDefault { | 27 class PasswordStoreX : public PasswordStoreDefault { |
| 28 public: | 28 public: |
| 29 // NativeBackends more or less implement the PaswordStore interface, but | 29 // NativeBackends more or less implement the PaswordStore interface, but |
| 30 // with return values rather than implicit consumer notification. | 30 // with return values rather than implicit consumer notification. |
| 31 class NativeBackend { | 31 class NativeBackend { |
| 32 public: | 32 public: |
| 33 typedef std::vector<webkit_glue::PasswordForm*> PasswordFormList; | 33 typedef std::vector<webkit::forms::PasswordForm*> PasswordFormList; |
| 34 | 34 |
| 35 virtual ~NativeBackend() {} | 35 virtual ~NativeBackend() {} |
| 36 | 36 |
| 37 virtual bool Init() = 0; | 37 virtual bool Init() = 0; |
| 38 | 38 |
| 39 virtual bool AddLogin(const webkit_glue::PasswordForm& form) = 0; | 39 virtual bool AddLogin(const webkit::forms::PasswordForm& form) = 0; |
| 40 virtual bool UpdateLogin(const webkit_glue::PasswordForm& form) = 0; | 40 virtual bool UpdateLogin(const webkit::forms::PasswordForm& form) = 0; |
| 41 virtual bool RemoveLogin(const webkit_glue::PasswordForm& form) = 0; | 41 virtual bool RemoveLogin(const webkit::forms::PasswordForm& form) = 0; |
| 42 virtual bool RemoveLoginsCreatedBetween(const base::Time& delete_begin, | 42 virtual bool RemoveLoginsCreatedBetween(const base::Time& delete_begin, |
| 43 const base::Time& delete_end) = 0; | 43 const base::Time& delete_end) = 0; |
| 44 virtual bool GetLogins(const webkit_glue::PasswordForm& form, | 44 virtual bool GetLogins(const webkit::forms::PasswordForm& form, |
| 45 PasswordFormList* forms) = 0; | 45 PasswordFormList* forms) = 0; |
| 46 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, | 46 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, |
| 47 const base::Time& get_end, | 47 const base::Time& get_end, |
| 48 PasswordFormList* forms) = 0; | 48 PasswordFormList* forms) = 0; |
| 49 virtual bool GetAutofillableLogins(PasswordFormList* forms) = 0; | 49 virtual bool GetAutofillableLogins(PasswordFormList* forms) = 0; |
| 50 virtual bool GetBlacklistLogins(PasswordFormList* forms) = 0; | 50 virtual bool GetBlacklistLogins(PasswordFormList* forms) = 0; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Takes ownership of |login_db| and |backend|. |backend| may be NULL in which | 53 // Takes ownership of |login_db| and |backend|. |backend| may be NULL in which |
| 54 // case this PasswordStoreX will act the same as PasswordStoreDefault. | 54 // case this PasswordStoreX will act the same as PasswordStoreDefault. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 69 // The caller promises that |prefs| will not be deleted any time soon. | 69 // The caller promises that |prefs| will not be deleted any time soon. |
| 70 static void SetPasswordsUseLocalProfileId(PrefService* prefs); | 70 static void SetPasswordsUseLocalProfileId(PrefService* prefs); |
| 71 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) | 71 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 friend class PasswordStoreXTest; | 74 friend class PasswordStoreXTest; |
| 75 | 75 |
| 76 virtual ~PasswordStoreX(); | 76 virtual ~PasswordStoreX(); |
| 77 | 77 |
| 78 // Implements PasswordStore interface. | 78 // Implements PasswordStore interface. |
| 79 virtual void AddLoginImpl(const webkit_glue::PasswordForm& form) OVERRIDE; | 79 virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; |
| 80 virtual void UpdateLoginImpl(const webkit_glue::PasswordForm& form) OVERRIDE; | 80 virtual void UpdateLoginImpl( |
| 81 virtual void RemoveLoginImpl(const webkit_glue::PasswordForm& form) OVERRIDE; | 81 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 82 virtual void RemoveLoginImpl( |
| 83 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 82 virtual void RemoveLoginsCreatedBetweenImpl( | 84 virtual void RemoveLoginsCreatedBetweenImpl( |
| 83 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 85 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; |
| 84 virtual void GetLoginsImpl(GetLoginsRequest* request, | 86 virtual void GetLoginsImpl(GetLoginsRequest* request, |
| 85 const webkit_glue::PasswordForm& form) OVERRIDE; | 87 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 86 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 88 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; |
| 87 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 89 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; |
| 88 virtual bool FillAutofillableLogins( | 90 virtual bool FillAutofillableLogins( |
| 89 std::vector<webkit_glue::PasswordForm*>* forms) OVERRIDE; | 91 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; |
| 90 virtual bool FillBlacklistLogins( | 92 virtual bool FillBlacklistLogins( |
| 91 std::vector<webkit_glue::PasswordForm*>* forms) OVERRIDE; | 93 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; |
| 92 | 94 |
| 93 // Sort logins by origin, like the ORDER BY clause in login_database.cc. | 95 // Sort logins by origin, like the ORDER BY clause in login_database.cc. |
| 94 void SortLoginsByOrigin(NativeBackend::PasswordFormList* list); | 96 void SortLoginsByOrigin(NativeBackend::PasswordFormList* list); |
| 95 | 97 |
| 96 // Check to see whether migration is necessary, and perform it if so. | 98 // Check to see whether migration is necessary, and perform it if so. |
| 97 void CheckMigration(); | 99 void CheckMigration(); |
| 98 | 100 |
| 99 // Return true if we should try using the native backend. | 101 // Return true if we should try using the native backend. |
| 100 bool use_native_backend() { return !!backend_.get(); } | 102 bool use_native_backend() { return !!backend_.get(); } |
| 101 | 103 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 116 // Whether we should allow falling back to the default store. If there is | 118 // Whether we should allow falling back to the default store. If there is |
| 117 // nothing to migrate, then the first attempt to use the native store will | 119 // nothing to migrate, then the first attempt to use the native store will |
| 118 // be the first time we try to use it and we should allow falling back. If | 120 // be the first time we try to use it and we should allow falling back. If |
| 119 // we have migrated successfully, then we do not allow falling back. | 121 // we have migrated successfully, then we do not allow falling back. |
| 120 bool allow_fallback_; | 122 bool allow_fallback_; |
| 121 | 123 |
| 122 DISALLOW_COPY_AND_ASSIGN(PasswordStoreX); | 124 DISALLOW_COPY_AND_ASSIGN(PasswordStoreX); |
| 123 }; | 125 }; |
| 124 | 126 |
| 125 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ | 127 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_X_H_ |
| OLD | NEW |