Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_PRESENTER_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_PRESENTER_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/prefs/pref_member.h" | 12 #include "base/prefs/pref_member.h" |
| 13 #include "chrome/browser/password_manager/password_store.h" | 13 #include "chrome/browser/password_manager/password_store.h" |
| 14 #include "chrome/browser/password_manager/password_store_consumer.h" | 14 #include "chrome/browser/password_manager/password_store_consumer.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | |
| 16 | 15 |
| 17 namespace autofill { | 16 namespace autofill { |
| 18 struct PasswordForm; | 17 struct PasswordForm; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace passwords_ui { | 20 namespace passwords_ui { |
| 22 class PasswordUIView; | 21 class PasswordUIView; |
| 23 } | 22 } |
| 24 | 23 |
| 25 class Profile; | 24 class Profile; |
| 26 | 25 |
| 27 namespace options { | 26 namespace passwords_ui { |
|
Patrick Dubroy
2013/11/13 11:38:07
I don't think you need this namespace. I think the
shashi
2013/11/13 17:44:22
Done.
| |
| 28 | 27 |
| 29 // Contains the common logic used by a PasswordUIView to | 28 // Contains the common logic used by a PasswordUIView to |
| 30 // interact with PasswordStore. It provides completion callbacks for | 29 // interact with PasswordStore. It provides completion callbacks for |
| 31 // PasswordStore operations and updates the view on PasswordStore changes. | 30 // PasswordStore operations and updates the view on PasswordStore changes. |
| 32 class PasswordManagerPresenter : public PasswordStore::Observer { | 31 class PasswordManagerPresenter : public PasswordStore::Observer { |
| 33 public: | 32 public: |
| 34 // |password_view| the UI view that owns this presenter, must not be NULL. | 33 // |password_view| the UI view that owns this presenter, must not be NULL. |
| 35 explicit PasswordManagerPresenter( | 34 explicit PasswordManagerPresenter( |
| 36 passwords_ui::PasswordUIView* password_view); | 35 passwords_ui::PasswordUIView* password_view); |
| 37 virtual ~PasswordManagerPresenter(); | 36 virtual ~PasswordManagerPresenter(); |
| 38 | 37 |
| 39 // PasswordStore::Observer implementation. | 38 // PasswordStore::Observer implementation. |
| 40 virtual void OnLoginsChanged() OVERRIDE; | 39 virtual void OnLoginsChanged() OVERRIDE; |
| 41 | 40 |
| 42 // Repopulates the password and exception entries. | 41 // Repopulates the password and exception entries. |
| 43 void UpdatePasswordLists(); | 42 void UpdatePasswordLists(); |
| 44 | 43 |
| 45 void Initialize(); | 44 void Initialize(); |
| 46 | 45 |
| 47 // Gets the password entry at |index|. | 46 // Gets the password entry at |index|. |
| 48 const autofill::PasswordForm& GetPassword(size_t index); | 47 const autofill::PasswordForm& GetPassword(size_t index); |
| 49 | 48 |
| 50 // Gets the password exception entry at |index|. | 49 // Gets the password exception entry at |index|. |
| 51 const autofill::PasswordForm& GetPasswordException(size_t index); | 50 const autofill::PasswordForm& GetPasswordException(size_t index); |
| 52 | 51 |
| 53 // Removes the saved password entry at |index|. | 52 // Removes the saved password entry at |index|. |
| 54 // |index| the entry index to be removed. | 53 // |index| the entry index to be removed. |
| 55 void HandleRemoveSavedPassword(size_t index); | 54 void RemoveSavedPassword(size_t index); |
|
Patrick Dubroy
2013/11/13 11:38:07
+1 for renaming these :-)
| |
| 56 | 55 |
| 57 // Removes the saved password exception entry at |index|. | 56 // Removes the saved password exception entry at |index|. |
| 58 // |index| the entry index to be removed. | 57 // |index| the entry index to be removed. |
| 59 void HandleRemovePasswordException(size_t index); | 58 void RemovePasswordException(size_t index); |
| 60 | 59 |
| 61 // Requests the plain text password for entry at |index| to be revealed. | 60 // Requests the plain text password for entry at |index| to be revealed. |
| 62 // |index| The index of the entry. | 61 // |index| The index of the entry. |
| 63 void HandleRequestShowPassword(size_t index); | 62 void RequestShowPassword(size_t index); |
| 64 | 63 |
| 65 private: | 64 private: |
| 66 friend class PasswordManagerPresenterTest; | 65 friend class PasswordManagerPresenterTest; |
| 67 | 66 |
| 68 // Returns the password store associated with the currently active profile. | 67 // Returns the password store associated with the currently active profile. |
| 69 PasswordStore* GetPasswordStore(); | 68 PasswordStore* GetPasswordStore(); |
| 70 | 69 |
| 71 // Returns true if the user needs to be authenticated before a plaintext | 70 // Returns true if the user needs to be authenticated before a plaintext |
| 72 // password is revealed. | 71 // password is revealed. |
| 73 bool IsAuthenticationRequired(); | 72 bool IsAuthenticationRequired(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 133 |
| 135 // Indicates whether or not the password manager should require the user to | 134 // Indicates whether or not the password manager should require the user to |
| 136 // reauthenticate before revealing plaintext passwords. | 135 // reauthenticate before revealing plaintext passwords. |
| 137 bool require_reauthentication_; | 136 bool require_reauthentication_; |
| 138 | 137 |
| 139 // The last time the user was successfully authenticated. | 138 // The last time the user was successfully authenticated. |
| 140 // Used to determine whether or not to reveal plaintext passwords. | 139 // Used to determine whether or not to reveal plaintext passwords. |
| 141 base::TimeTicks last_authentication_time_; | 140 base::TimeTicks last_authentication_time_; |
| 142 | 141 |
| 143 // UI view that owns this presenter. | 142 // UI view that owns this presenter. |
| 144 passwords_ui::PasswordUIView* password_view_; | 143 PasswordUIView* password_view_; |
| 145 | 144 |
| 146 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); | 145 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); |
| 147 }; | 146 }; |
| 148 | 147 |
| 149 } // namespace options | 148 } // namespace passwords_ui |
| 150 | 149 |
| 151 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_PRESENTER_H_ | 150 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ |
| OLD | NEW |