OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/password_manager/password_manager_infobar_delegate.h" | |
13 #include "chrome/browser/ui/passwords/manage_passwords_state.h" | |
14 #include "components/password_manager/core/browser/password_form_manager.h" | |
15 | |
16 namespace content { | |
17 class WebContents; | |
18 } | |
19 | |
20 // An infobar delegate which asks the user if the password should be updated for | |
21 // a | |
Peter Kasting
2016/02/22 22:38:13
Fix wrapping, please
melandory
2016/02/23 16:35:07
Sorry, cl format sometimes does this.
| |
22 // set of saved credentials for a site. If several such sets are present, the | |
23 // user | |
24 // can choose which one to update. PasswordManager displays this infobar when | |
25 // the | |
26 // user signs into the site with a new password for a known username or fills in | |
27 // a | |
28 // password change form. | |
29 class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate { | |
30 public: | |
31 static void Create( | |
32 content::WebContents* web_contents, | |
33 scoped_ptr<password_manager::PasswordFormManager> form_to_update); | |
34 | |
35 ~UpdatePasswordInfoBarDelegate() override; | |
36 | |
37 base::string16 branding() const { return branding_; } | |
38 bool is_smartlock_branding_enabled() const { | |
39 return is_smartlock_branding_enabled_; | |
40 } | |
41 | |
42 // Returns true if infobar for the multi credentials case should be shown, e.g | |
43 // user changing a password on a password change form and has several | |
44 // credentials save for the web site. | |
Peter Kasting
2016/02/22 22:38:13
Nit: Grammar; how about "Returns whether the user
melandory
2016/02/23 16:35:07
Done.
| |
45 bool ShowMultipleAccounts() const; | |
46 | |
47 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() const; | |
Peter Kasting
2016/02/22 22:38:13
Nit: This return type is super ugly. Consider add
melandory
2016/02/23 16:35:07
Will address in separate CL.
| |
48 | |
49 // Returns the username of the saved credentials in the case when there is | |
50 // only one credential pair stored. | |
51 base::string16 GetUsernameForSingleAccountCase(); | |
52 | |
53 private: | |
54 UpdatePasswordInfoBarDelegate( | |
55 content::WebContents* web_contents, | |
56 scoped_ptr<password_manager::PasswordFormManager> form_to_update, | |
57 bool is_smartlock_branding_enabled); | |
58 | |
59 // ConfirmInfoBarDelegate: | |
60 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
61 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
62 bool Accept() override; | |
63 bool Cancel() override; | |
64 | |
65 ManagePasswordsState passwords_data_; | |
Peter Kasting
2016/02/22 22:38:13
Nit: Name this |passwords_state_| for parallel wit
melandory
2016/02/23 16:35:08
Done.
| |
66 base::string16 branding_; | |
67 bool is_smartlock_branding_enabled_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate); | |
70 }; | |
71 | |
72 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ | |
OLD | NEW |