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

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

Issue 1193143003: Enable import/export of passwords into/from Password Manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "components/password_manager/core/browser/password_store.h" 16 #include "components/password_manager/core/browser/password_store.h"
17 #include "components/password_manager/core/browser/password_store_consumer.h" 17 #include "components/password_manager/core/browser/password_store_consumer.h"
18 #include "components/prefs/pref_member.h" 18 #include "components/prefs/pref_member.h"
19 #include "ui/shell_dialogs/select_file_dialog.h"
19 20
20 namespace autofill { 21 namespace autofill {
21 struct PasswordForm; 22 struct PasswordForm;
22 } 23 }
23 24
24 class PasswordUIView; 25 class PasswordUIView;
25 26
26 class Profile; 27 class Profile;
27 28
28 // Contains the common logic used by a PasswordUIView to 29 // Contains the common logic used by a PasswordUIView to
(...skipping 11 matching lines...) Expand all
40 const password_manager::PasswordStoreChangeList& changes) override; 41 const password_manager::PasswordStoreChangeList& changes) override;
41 42
42 // Repopulates the password and exception entries. 43 // Repopulates the password and exception entries.
43 void UpdatePasswordLists(); 44 void UpdatePasswordLists();
44 45
45 void Initialize(); 46 void Initialize();
46 47
47 // Gets the password entry at |index|. 48 // Gets the password entry at |index|.
48 const autofill::PasswordForm* GetPassword(size_t index); 49 const autofill::PasswordForm* GetPassword(size_t index);
49 50
51 // Gets all password entries.
52 std::vector<scoped_ptr<autofill::PasswordForm>> GetAllPasswords();
53
50 // Gets the password exception entry at |index|. 54 // Gets the password exception entry at |index|.
51 const autofill::PasswordForm* GetPasswordException(size_t index); 55 const autofill::PasswordForm* GetPasswordException(size_t index);
52 56
53 // Removes the saved password entry at |index|. 57 // Removes the saved password entry at |index|.
54 // |index| the entry index to be removed. 58 // |index| the entry index to be removed.
55 void RemoveSavedPassword(size_t index); 59 void RemoveSavedPassword(size_t index);
56 60
57 // Removes the saved password exception entry at |index|. 61 // Removes the saved password exception entry at |index|.
58 // |index| the entry index to be removed. 62 // |index| the entry index to be removed.
59 void RemovePasswordException(size_t index); 63 void RemovePasswordException(size_t index);
60 64
61 // Requests the plain text password for entry at |index| to be revealed. 65 // Requests the plain text password for entry at |index| to be revealed.
62 // |index| The index of the entry. 66 // |index| The index of the entry.
63 void RequestShowPassword(size_t index); 67 void RequestShowPassword(size_t index);
64 68
69 // Returns true if the user is authenticated.
70 virtual bool IsUserAuthenticated();
71
65 private: 72 private:
66 friend class PasswordManagerPresenterTest; 73 friend class PasswordManagerPresenterTest;
67 74
68 // Returns the password store associated with the currently active profile. 75 // Returns true if the user needs to be authenticated before a plaintext
69 password_manager::PasswordStore* GetPasswordStore(); 76 // password is revealed or exported.
77 bool IsAuthenticationRequired();
70 78
71 // Sets the password and exception list of the UI view. 79 // Sets the password and exception list of the UI view.
72 void SetPasswordList(); 80 void SetPasswordList();
73 void SetPasswordExceptionList(); 81 void SetPasswordExceptionList();
74 82
83 // Returns the password store associated with the currently active profile.
84 password_manager::PasswordStore* GetPasswordStore();
85
75 // A short class to mediate requests to the password store. 86 // A short class to mediate requests to the password store.
76 class ListPopulater : public password_manager::PasswordStoreConsumer { 87 class ListPopulater : public password_manager::PasswordStoreConsumer {
77 public: 88 public:
78 explicit ListPopulater(PasswordManagerPresenter* page); 89 explicit ListPopulater(PasswordManagerPresenter* page);
79 ~ListPopulater() override; 90 ~ListPopulater() override;
80 91
81 // Send a query to the password store to populate a list. 92 // Send a query to the password store to populate a list.
82 virtual void Populate() = 0; 93 virtual void Populate() = 0;
83 94
84 protected: 95 protected:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // UI view that owns this presenter. 143 // UI view that owns this presenter.
133 PasswordUIView* password_view_; 144 PasswordUIView* password_view_;
134 145
135 // User pref for storing accept languages. 146 // User pref for storing accept languages.
136 std::string languages_; 147 std::string languages_;
137 148
138 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter); 149 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenter);
139 }; 150 };
140 151
141 #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