Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
vabr (Chromium)
2014/06/17 15:28:41
Many of the comments I made for Gnome apply here a
vasilii
2014/06/17 17:24:14
Done.
| |
| 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_NATIVE_BACKEND_KWALLET_X_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 virtual bool Init() OVERRIDE; | 40 virtual bool Init() OVERRIDE; |
| 41 | 41 |
| 42 // Implements NativeBackend interface. | 42 // Implements NativeBackend interface. |
| 43 virtual password_manager::PasswordStoreChangeList AddLogin( | 43 virtual password_manager::PasswordStoreChangeList AddLogin( |
| 44 const autofill::PasswordForm& form) OVERRIDE; | 44 const autofill::PasswordForm& form) OVERRIDE; |
| 45 virtual bool UpdateLogin( | 45 virtual bool UpdateLogin( |
| 46 const autofill::PasswordForm& form, | 46 const autofill::PasswordForm& form, |
| 47 password_manager::PasswordStoreChangeList* changes) OVERRIDE; | 47 password_manager::PasswordStoreChangeList* changes) OVERRIDE; |
| 48 virtual bool RemoveLogin(const autofill::PasswordForm& form) OVERRIDE; | 48 virtual bool RemoveLogin(const autofill::PasswordForm& form) OVERRIDE; |
| 49 virtual bool RemoveLoginsCreatedBetween( | 49 virtual bool RemoveLoginsCreatedBetween(base::Time delete_begin, |
| 50 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 50 base::Time delete_end) OVERRIDE; |
| 51 virtual bool RemoveLoginsSyncedBetween( | |
| 52 base::Time delete_begin, | |
| 53 base::Time delete_end, | |
| 54 password_manager::PasswordStoreChangeList* changes) OVERRIDE; | |
| 51 virtual bool GetLogins(const autofill::PasswordForm& form, | 55 virtual bool GetLogins(const autofill::PasswordForm& form, |
| 52 PasswordFormList* forms) OVERRIDE; | 56 PasswordFormList* forms) OVERRIDE; |
| 53 virtual bool GetLoginsCreatedBetween(const base::Time& get_begin, | 57 virtual bool GetLoginsCreatedBetween(base::Time get_begin, base::Time get_end, |
| 54 const base::Time& get_end, | |
| 55 PasswordFormList* forms) OVERRIDE; | 58 PasswordFormList* forms) OVERRIDE; |
| 56 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE; | 59 virtual bool GetAutofillableLogins(PasswordFormList* forms) OVERRIDE; |
| 57 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE; | 60 virtual bool GetBlacklistLogins(PasswordFormList* forms) OVERRIDE; |
| 58 | 61 |
| 59 protected: | 62 protected: |
| 60 // Invalid handle returned by WalletHandle(). | 63 // Invalid handle returned by WalletHandle(). |
| 61 static const int kInvalidKWalletHandle = -1; | 64 static const int kInvalidKWalletHandle = -1; |
| 62 | 65 |
| 63 // Internally used by Init(), but also for testing to provide a mock bus. | 66 // Internally used by Init(), but also for testing to provide a mock bus. |
| 64 bool InitWithBus(scoped_refptr<dbus::Bus> optional_bus); | 67 bool InitWithBus(scoped_refptr<dbus::Bus> optional_bus); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 85 // Reads PasswordForms from the wallet that match the given signon_realm. | 88 // Reads PasswordForms from the wallet that match the given signon_realm. |
| 86 bool GetLoginsList(PasswordFormList* forms, | 89 bool GetLoginsList(PasswordFormList* forms, |
| 87 const std::string& signon_realm, | 90 const std::string& signon_realm, |
| 88 int wallet_handle); | 91 int wallet_handle); |
| 89 | 92 |
| 90 // Reads PasswordForms from the wallet with the given autofillability state. | 93 // Reads PasswordForms from the wallet with the given autofillability state. |
| 91 bool GetLoginsList(PasswordFormList* forms, | 94 bool GetLoginsList(PasswordFormList* forms, |
| 92 bool autofillable, | 95 bool autofillable, |
| 93 int wallet_handle); | 96 int wallet_handle); |
| 94 | 97 |
| 95 // Reads PasswordForms from the wallet created in the given time range. | 98 // Reads PasswordForms from the wallet created/synced in the given time range. |
| 96 bool GetLoginsList(PasswordFormList* forms, | 99 bool GetLoginsList(PasswordFormList* forms, |
| 97 const base::Time& begin, | 100 const base::Time& begin, |
| 98 const base::Time& end, | 101 const base::Time& end, |
| 99 int wallet_handle); | 102 int wallet_handle, |
| 103 bool date_is_creation); | |
| 100 | 104 |
| 101 // Helper for some of the above GetLoginsList() methods. | 105 // Helper for some of the above GetLoginsList() methods. |
| 102 bool GetAllLogins(PasswordFormList* forms, int wallet_handle); | 106 bool GetAllLogins(PasswordFormList* forms, int wallet_handle); |
| 103 | 107 |
| 104 // Writes a list of PasswordForms to the wallet with the given signon_realm. | 108 // Writes a list of PasswordForms to the wallet with the given signon_realm. |
| 105 // Overwrites any existing list for this signon_realm. Removes the entry if | 109 // Overwrites any existing list for this signon_realm. Removes the entry if |
| 106 // |forms| is empty. Returns true on success. | 110 // |forms| is empty. Returns true on success. |
| 107 bool SetLoginsList(const PasswordFormList& forms, | 111 bool SetLoginsList(const PasswordFormList& forms, |
| 108 const std::string& signon_realm, | 112 const std::string& signon_realm, |
| 109 int wallet_handle); | 113 int wallet_handle); |
| 110 | 114 |
| 115 bool RemoveLoginsBetween(base::Time delete_begin, base::Time delete_end, | |
| 116 bool date_is_creation, | |
| 117 password_manager::PasswordStoreChangeList* changes); | |
| 118 | |
| 111 // Opens the wallet and ensures that the "Chrome Form Data" folder exists. | 119 // Opens the wallet and ensures that the "Chrome Form Data" folder exists. |
| 112 // Returns kInvalidWalletHandle on error. | 120 // Returns kInvalidWalletHandle on error. |
| 113 int WalletHandle(); | 121 int WalletHandle(); |
| 114 | 122 |
| 115 // Serializes a list of PasswordForms to be stored in the wallet. | 123 // Serializes a list of PasswordForms to be stored in the wallet. |
| 116 static void SerializeValue(const PasswordFormList& forms, Pickle* pickle); | 124 static void SerializeValue(const PasswordFormList& forms, Pickle* pickle); |
| 117 | 125 |
| 118 // Deserializes a list of PasswordForms from the wallet. | 126 // Deserializes a list of PasswordForms from the wallet. |
| 119 // |size_32| controls reading the size field within the pickle as 32 bits. | 127 // |size_32| controls reading the size field within the pickle as 32 bits. |
| 120 // We used to use Pickle::WriteSize() to write the number of password forms, | 128 // We used to use Pickle::WriteSize() to write the number of password forms, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 146 | 154 |
| 147 // The name of the wallet we've opened. Set during Init(). | 155 // The name of the wallet we've opened. Set during Init(). |
| 148 std::string wallet_name_; | 156 std::string wallet_name_; |
| 149 // The application name (e.g. "Chromium"), shown in KWallet auth dialogs. | 157 // The application name (e.g. "Chromium"), shown in KWallet auth dialogs. |
| 150 const std::string app_name_; | 158 const std::string app_name_; |
| 151 | 159 |
| 152 DISALLOW_COPY_AND_ASSIGN(NativeBackendKWallet); | 160 DISALLOW_COPY_AND_ASSIGN(NativeBackendKWallet); |
| 153 }; | 161 }; |
| 154 | 162 |
| 155 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_ | 163 #endif // CHROME_BROWSER_PASSWORD_MANAGER_NATIVE_BACKEND_KWALLET_X_H_ |
| OLD | NEW |