Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter.h

Issue 71003002: Merge browser/ui/password and browser/ui/passwords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 {
22 class PasswordUIView; 20 class PasswordUIView;
23 }
24 21
25 class Profile; 22 class Profile;
26 23
27 namespace options {
28
29 // Contains the common logic used by a PasswordUIView to 24 // Contains the common logic used by a PasswordUIView to
30 // interact with PasswordStore. It provides completion callbacks for 25 // interact with PasswordStore. It provides completion callbacks for
31 // PasswordStore operations and updates the view on PasswordStore changes. 26 // PasswordStore operations and updates the view on PasswordStore changes.
32 class PasswordManagerPresenter : public PasswordStore::Observer { 27 class PasswordManagerPresenter : public PasswordStore::Observer {
33 public: 28 public:
34 // |password_view| the UI view that owns this presenter, must not be NULL. 29 // |password_view| the UI view that owns this presenter, must not be NULL.
35 explicit PasswordManagerPresenter( 30 explicit PasswordManagerPresenter(PasswordUIView* password_view);
36 passwords_ui::PasswordUIView* password_view);
37 virtual ~PasswordManagerPresenter(); 31 virtual ~PasswordManagerPresenter();
38 32
39 // PasswordStore::Observer implementation. 33 // PasswordStore::Observer implementation.
40 virtual void OnLoginsChanged() OVERRIDE; 34 virtual void OnLoginsChanged() OVERRIDE;
41 35
42 // Repopulates the password and exception entries. 36 // Repopulates the password and exception entries.
43 void UpdatePasswordLists(); 37 void UpdatePasswordLists();
44 38
45 void Initialize(); 39 void Initialize();
46 40
47 // Gets the password entry at |index|. 41 // Gets the password entry at |index|.
48 const autofill::PasswordForm& GetPassword(size_t index); 42 const autofill::PasswordForm& GetPassword(size_t index);
49 43
50 // Gets the password exception entry at |index|. 44 // Gets the password exception entry at |index|.
51 const autofill::PasswordForm& GetPasswordException(size_t index); 45 const autofill::PasswordForm& GetPasswordException(size_t index);
52 46
53 // Removes the saved password entry at |index|. 47 // Removes the saved password entry at |index|.
54 // |index| the entry index to be removed. 48 // |index| the entry index to be removed.
55 void HandleRemoveSavedPassword(size_t index); 49 void RemoveSavedPassword(size_t index);
56 50
57 // Removes the saved password exception entry at |index|. 51 // Removes the saved password exception entry at |index|.
58 // |index| the entry index to be removed. 52 // |index| the entry index to be removed.
59 void HandleRemovePasswordException(size_t index); 53 void RemovePasswordException(size_t index);
60 54
61 // Requests the plain text password for entry at |index| to be revealed. 55 // Requests the plain text password for entry at |index| to be revealed.
62 // |index| The index of the entry. 56 // |index| The index of the entry.
63 void HandleRequestShowPassword(size_t index); 57 void RequestShowPassword(size_t index);
64 58
65 private: 59 private:
66 friend class PasswordManagerPresenterTest; 60 friend class PasswordManagerPresenterTest;
67 61
68 // Returns the password store associated with the currently active profile. 62 // Returns the password store associated with the currently active profile.
69 PasswordStore* GetPasswordStore(); 63 PasswordStore* GetPasswordStore();
70 64
71 // Returns true if the user needs to be authenticated before a plaintext 65 // Returns true if the user needs to be authenticated before a plaintext
72 // password is revealed. 66 // password is revealed.
73 bool IsAuthenticationRequired(); 67 bool IsAuthenticationRequired();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 128
135 // Indicates whether or not the password manager should require the user to 129 // Indicates whether or not the password manager should require the user to
136 // reauthenticate before revealing plaintext passwords. 130 // reauthenticate before revealing plaintext passwords.
137 bool require_reauthentication_; 131 bool require_reauthentication_;
138 132
139 // The last time the user was successfully authenticated. 133 // The last time the user was successfully authenticated.
140 // Used to determine whether or not to reveal plaintext passwords. 134 // Used to determine whether or not to reveal plaintext passwords.
141 base::TimeTicks last_authentication_time_; 135 base::TimeTicks last_authentication_time_;
142 136
143 // UI view that owns this presenter. 137 // UI view that owns this presenter.
144 passwords_ui::PasswordUIView* password_view_; 138 PasswordUIView* password_view_;
145 139
146 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); 140 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter);
147 }; 141 };
148 142
149 } // namespace options 143 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
150
151 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_PRESENTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/password/password_ui_view.h ('k') | chrome/browser/ui/passwords/password_manager_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698