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

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

Issue 489103004: Allow editing passwords in settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 6 years, 3 months 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
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_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_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
Dan Beam 2014/09/11 05:17:58 #include "base/basictypes.h" // For size_t.
jaekyeom 2014/09/12 10:35:58 Done.
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 "components/password_manager/core/browser/password_store.h" 13 #include "components/password_manager/core/browser/password_store.h"
14 #include "components/password_manager/core/browser/password_store_consumer.h" 14 #include "components/password_manager/core/browser/password_store_consumer.h"
15 15
16 namespace autofill { 16 namespace autofill {
17 struct PasswordForm; 17 struct PasswordForm;
18 } 18 }
Dan Beam 2014/09/11 05:17:58 forward declare or include headers for: - base::st
jaekyeom 2014/09/12 10:35:58 Done.
19 19
20 class PasswordUIView; 20 class PasswordUIView;
21 21
22 class Profile; 22 class Profile;
23 23
24 // Contains the common logic used by a PasswordUIView to 24 // Contains the common logic used by a PasswordUIView to
25 // interact with PasswordStore. It provides completion callbacks for 25 // interact with PasswordStore. It provides completion callbacks for
26 // PasswordStore operations and updates the view on PasswordStore changes. 26 // PasswordStore operations and updates the view on PasswordStore changes.
27 class PasswordManagerPresenter 27 class PasswordManagerPresenter
28 : public password_manager::PasswordStore::Observer { 28 : public password_manager::PasswordStore::Observer {
29 public: 29 public:
30 // |password_view| the UI view that owns this presenter, must not be NULL. 30 // |password_view| the UI view that owns this presenter, must not be NULL.
31 explicit PasswordManagerPresenter(PasswordUIView* password_view); 31 explicit PasswordManagerPresenter(PasswordUIView* password_view);
32 virtual ~PasswordManagerPresenter(); 32 virtual ~PasswordManagerPresenter();
33 33
Dan Beam 2014/09/11 05:17:58 ^ static would probably go here
jaekyeom 2014/09/12 10:35:58 Done.
34 // PasswordStore::Observer implementation. 34 // PasswordStore::Observer implementation.
35 virtual void OnLoginsChanged( 35 virtual void OnLoginsChanged(
36 const password_manager::PasswordStoreChangeList& changes) OVERRIDE; 36 const password_manager::PasswordStoreChangeList& changes) OVERRIDE;
37 37
38 // Repopulates the password and exception entries. 38 // Repopulates the password and exception entries.
39 void UpdatePasswordLists(); 39 void UpdatePasswordLists();
40 40
41 void Initialize(); 41 void Initialize();
42 42
43 // Gets the password entry at |index|. 43 // Gets the password entry at |index|.
44 const autofill::PasswordForm* GetPassword(size_t index); 44 const autofill::PasswordForm* GetPassword(size_t index);
45 45
46 // Gets the password exception entry at |index|. 46 // Gets the password exception entry at |index|.
47 const autofill::PasswordForm* GetPasswordException(size_t index); 47 const autofill::PasswordForm* GetPasswordException(size_t index);
48 48
49 // Checks if |origin| is valid for adding a new password entry.
50 static bool CheckOriginValidityForAdding(const GURL& origin);
Dan Beam 2014/09/11 05:17:58 nit: move static method right under ctor
jaekyeom 2014/09/12 10:35:58 Done.
51
52 // Adds a new password entry with |origin|, |username_value|, and
53 // |password_value|. |origin| should have been validated by
Dan Beam 2014/09/11 05:17:58 nit: 1 \s between sentences
jaekyeom 2014/09/12 10:35:58 Done.
54 // CheckOriginValidityForAdding, and |password_value| should be non-empty.
55 void AddPassword(const GURL& origin,
56 const base::string16& username_value,
57 const base::string16& password_value);
58
59 // Updates the entry at |index| with |password_value|. |password_value|
60 // should be non-empty.
61 void UpdatePassword(size_t index, const base::string16& password_value);
62
49 // Removes the saved password entry at |index|. 63 // Removes the saved password entry at |index|.
50 // |index| the entry index to be removed. 64 // |index| the entry index to be removed.
51 void RemoveSavedPassword(size_t index); 65 void RemoveSavedPassword(size_t index);
52 66
53 // Removes the saved password exception entry at |index|. 67 // Removes the saved password exception entry at |index|.
54 // |index| the entry index to be removed. 68 // |index| the entry index to be removed.
55 void RemovePasswordException(size_t index); 69 void RemovePasswordException(size_t index);
56 70
57 // Requests the plain text password for entry at |index| to be revealed. 71 // Requests the plain text password for entry at |index| to be revealed.
58 // |index| The index of the entry. 72 // |index| The index of the entry.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Used to determine whether or not to reveal plaintext passwords. 143 // Used to determine whether or not to reveal plaintext passwords.
130 base::TimeTicks last_authentication_time_; 144 base::TimeTicks last_authentication_time_;
131 145
132 // UI view that owns this presenter. 146 // UI view that owns this presenter.
133 PasswordUIView* password_view_; 147 PasswordUIView* password_view_;
134 148
135 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); 149 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter);
136 }; 150 };
137 151
138 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_ 152 #endif // CHROME_BROWSER_UI_PASSWORDS_PASSWORD_MANAGER_PRESENTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698