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

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

Issue 848723002: Credential Manager API: Showing both local and federated logins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Not ready for review Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
7 7
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/timer/elapsed_timer.h" 9 #include "base/timer/elapsed_timer.h"
10 #include "components/autofill/core/common/password_form.h" 10 #include "components/autofill/core/common/password_form.h"
11 #include "components/password_manager/core/browser/password_store.h" 11 #include "components/password_manager/core/browser/password_store.h"
12 #include "components/password_manager/core/common/password_manager_ui.h" 12 #include "components/password_manager/core/common/password_manager_ui.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/browser/web_contents_user_data.h" 14 #include "content/public/browser/web_contents_user_data.h"
15 15
16 namespace content { 16 namespace content {
17 class WebContents; 17 class WebContents;
18 } 18 }
19 19
20 namespace password_manager { 20 namespace password_manager {
21 enum class CredentialType : unsigned int;
vasilii 2015/01/12 18:36:45 doesn't match the definition
melandory 2015/01/13 09:07:54 Yes, because I've submit another CL, which changes
21 struct CredentialInfo; 22 struct CredentialInfo;
22 class PasswordFormManager; 23 class PasswordFormManager;
23 } 24 }
24 25
25 class ManagePasswordsIcon; 26 class ManagePasswordsIcon;
26 27
27 // Per-tab class to control the Omnibox password icon and bubble. 28 // Per-tab class to control the Omnibox password icon and bubble.
28 class ManagePasswordsUIController 29 class ManagePasswordsUIController
29 : public content::WebContentsObserver, 30 : public content::WebContentsObserver,
30 public content::WebContentsUserData<ManagePasswordsUIController>, 31 public content::WebContentsUserData<ManagePasswordsUIController>,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 void OnLoginsChanged( 74 void OnLoginsChanged(
74 const password_manager::PasswordStoreChangeList& changes) override; 75 const password_manager::PasswordStoreChangeList& changes) override;
75 76
76 // Called from the model when the user chooses to save a password; passes the 77 // Called from the model when the user chooses to save a password; passes the
77 // action off to the FormManager. The controller MUST be in a pending state, 78 // action off to the FormManager. The controller MUST be in a pending state,
78 // and WILL be in MANAGE_STATE after this method executes. 79 // and WILL be in MANAGE_STATE after this method executes.
79 virtual void SavePassword(); 80 virtual void SavePassword();
80 81
81 // Called from the model when the user chooses a credential. 82 // Called from the model when the user chooses a credential.
82 // The controller MUST be in a pending credentials state. 83 // The controller MUST be in a pending credentials state.
83 virtual void ChooseCredential(bool was_chosen, 84 virtual void ChooseCredential(
84 const autofill::PasswordForm& form); 85 bool was_chosen,
vasilii 2015/01/12 18:36:45 no need for this parameter anymore
melandory 2015/01/13 10:16:02 Done.
86 const autofill::PasswordForm& form,
87 password_manager::CredentialType credential_type);
85 88
86 // Called from the model when the user chooses to never save passwords; passes 89 // Called from the model when the user chooses to never save passwords; passes
87 // the action off to the FormManager. The controller MUST be in a pending 90 // the action off to the FormManager. The controller MUST be in a pending
88 // state, and WILL be in BLACKLIST_STATE after this method executes. 91 // state, and WILL be in BLACKLIST_STATE after this method executes.
89 virtual void NeverSavePassword(); 92 virtual void NeverSavePassword();
90 93
91 // Called from the model when the user chooses to unblacklist the site. The 94 // Called from the model when the user chooses to unblacklist the site. The
92 // controller MUST be in BLACKLIST_STATE, and WILL be in MANAGE_STATE after 95 // controller MUST be in BLACKLIST_STATE, and WILL be in MANAGE_STATE after
93 // this method executes. 96 // this method executes.
94 virtual void UnblacklistSite(); 97 virtual void UnblacklistSite();
95 98
96 // Open a new tab, pointing to the password manager settings page. 99 // Open a new tab, pointing to the password manager settings page.
97 virtual void NavigateToPasswordManagerSettingsPage(); 100 virtual void NavigateToPasswordManagerSettingsPage();
98 101
99 virtual const autofill::PasswordForm& PendingPassword() const; 102 virtual const autofill::PasswordForm& PendingPassword() const;
100 103
101 // Set the state of the Omnibox icon, and possibly show the associated bubble 104 // Set the state of the Omnibox icon, and possibly show the associated bubble
102 // without user interaction. 105 // without user interaction.
103 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon); 106 virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon);
104 107
105 // Called from the model when the bubble is displayed. 108 // Called from the model when the bubble is displayed.
106 void OnBubbleShown(); 109 void OnBubbleShown();
107 110
108 password_manager::ui::State state() const { return state_; } 111 password_manager::ui::State state() const { return state_; }
109 112
110 ScopedVector<autofill::PasswordForm>& new_password_forms() { 113 ScopedVector<autofill::PasswordForm>& new_password_forms() {
vasilii 2015/01/12 18:36:45 unused
111 return new_password_forms_; 114 return new_password_forms_;
112 } 115 }
113 116
117 ScopedVector<autofill::PasswordForm>& federated_credentials_forms() {
118 return federated_credentials_forms_;
119 }
120
121 ScopedVector<autofill::PasswordForm>& local_credentials_forms() {
122 return local_credentials_forms_;
123 }
124
114 // True if a password is sitting around, waiting for a user to decide whether 125 // True if a password is sitting around, waiting for a user to decide whether
115 // or not to save it. 126 // or not to save it.
116 bool PasswordPendingUserDecision() const; 127 bool PasswordPendingUserDecision() const;
117 128
118 const autofill::ConstPasswordFormMap& best_matches() const { 129 const autofill::ConstPasswordFormMap& best_matches() const {
119 return password_form_map_; 130 return password_form_map_;
120 } 131 }
121 132
122 const GURL& origin() const { return origin_; } 133 const GURL& origin() const { return origin_; }
123 134
(...skipping 21 matching lines...) Expand all
145 const content::FrameNavigateParams& params) override; 156 const content::FrameNavigateParams& params) override;
146 void WasHidden() override; 157 void WasHidden() override;
147 158
148 // Sets |state_|. Protected so we can manipulate the value in tests. 159 // Sets |state_|. Protected so we can manipulate the value in tests.
149 void SetState(password_manager::ui::State state); 160 void SetState(password_manager::ui::State state);
150 161
151 // We create copies of PasswordForm objects that come in with unclear lifetime 162 // We create copies of PasswordForm objects that come in with unclear lifetime
152 // and store them in this vector as well as in |password_form_map_| to ensure 163 // and store them in this vector as well as in |password_form_map_| to ensure
153 // that we destroy them correctly. If |new_password_forms_| gets cleared then 164 // that we destroy them correctly. If |new_password_forms_| gets cleared then
154 // |password_form_map_| is to be cleared too. 165 // |password_form_map_| is to be cleared too.
155 ScopedVector<autofill::PasswordForm> new_password_forms_; 166 ScopedVector<autofill::PasswordForm> new_password_forms_;
Mike West 2015/01/13 19:41:46 I think you can kill this as well.
vasilii 2015/01/14 09:57:48 It is for the traditional bubble. In case user add
156 167
168 // Federated credentials.
169 ScopedVector<autofill::PasswordForm> federated_credentials_forms_;
170
171 // Local credentials.
172 ScopedVector<autofill::PasswordForm> local_credentials_forms_;
173
157 // All previously stored credentials for a specific site. 174 // All previously stored credentials for a specific site.
158 // Protected, not private, so we can mess with the value in 175 // Protected, not private, so we can mess with the value in
159 // ManagePasswordsUIControllerMock. 176 // ManagePasswordsUIControllerMock.
160 autofill::ConstPasswordFormMap password_form_map_; 177 autofill::ConstPasswordFormMap password_form_map_;
161 178
162 private: 179 private:
163 friend class content::WebContentsUserData<ManagePasswordsUIController>; 180 friend class content::WebContentsUserData<ManagePasswordsUIController>;
164 181
165 // Shows the password bubble without user interaction. The controller MUST 182 // Shows the password bubble without user interaction. The controller MUST
166 // be in PENDING_PASSWORD_AND_BUBBLE_STATE. 183 // be in PENDING_PASSWORD_AND_BUBBLE_STATE.
(...skipping 26 matching lines...) Expand all
193 210
194 // The origin of the form we're currently dealing with; we'll use this to 211 // The origin of the form we're currently dealing with; we'll use this to
195 // determine which PasswordStore changes we should care about when updating 212 // determine which PasswordStore changes we should care about when updating
196 // |password_form_map_|. 213 // |password_form_map_|.
197 GURL origin_; 214 GURL origin_;
198 215
199 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController); 216 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsUIController);
200 }; 217 };
201 218
202 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_ 219 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_UI_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698