OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
vabr (Chromium)
2016/01/13 09:44:46
2015 -> 2016
melandory
2016/01/13 15:11:37
Done.
| |
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/memory/scoped_ptr.h" | |
11 #include "chrome/browser/password_manager/password_manager_infobar_delegate.h" | |
12 #include "chrome/browser/ui/passwords/manage_passwords_state.h" | |
13 #include "components/password_manager/core/browser/password_form_manager.h" | |
14 | |
15 namespace content { | |
16 class WebContents; | |
17 } | |
18 | |
19 // If PasswordManager encounters the login which is already known or user fills | |
20 // the password change form, then user is prompted with an infobar asking if | |
21 // already saved credentials should be updated or not. | |
22 // In case several credentials are stored for the web site, user can choose | |
23 // which one should be updated. | |
24 class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate { | |
25 public: | |
26 static void Create( | |
27 content::WebContents* web_contents, | |
28 scoped_ptr<password_manager::PasswordFormManager> form_to_update); | |
29 | |
30 ~UpdatePasswordInfoBarDelegate() override; | |
31 | |
32 base::string16 branding() const { return branding_; } | |
33 | |
34 bool is_smartlock_branding_enabled() const { | |
35 return is_smartlock_branding_enabled_; | |
36 } | |
37 | |
38 // Returns true if infobar for the multi credentials case should be shown, e.g | |
39 // user changing a password on a password change form and has several | |
40 // credentials save for the web site. | |
41 bool ShowMultipleAccounts() const; | |
42 | |
43 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() const { | |
44 return passwords_data_.GetCurrentForms(); | |
45 } | |
46 | |
47 // Returns the username of the saved credentials in case when there is only | |
48 // one credential pair stored. | |
49 base::string16 GetUsernameForOneAccountCase(); | |
50 | |
51 // Updates the form with index |from_index| in case of multiple credentials or | |
vabr (Chromium)
2016/01/13 09:44:46
typo: from_index -> form_index
melandory
2016/01/13 15:11:37
Done.
| |
52 // the only available form otherwise. | |
53 void UpdatePasswordInternal(unsigned int form_index); | |
vabr (Chromium)
2016/01/13 09:44:46
|form_index| comes from jint, which is signed. The
melandory
2016/01/13 15:11:36
Done.
| |
54 | |
55 // ConfirmInfoBarDelegate: | |
56 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
57 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
58 bool Accept() override; | |
59 bool Cancel() override; | |
60 | |
61 private: | |
62 UpdatePasswordInfoBarDelegate( | |
63 content::WebContents* web_contents, | |
64 scoped_ptr<password_manager::PasswordFormManager> form_to_update, | |
65 bool is_smartlock_branding_enabled); | |
66 | |
67 ManagePasswordsState passwords_data_; | |
68 base::string16 branding_; | |
69 bool is_smartlock_branding_enabled_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate); | |
vabr (Chromium)
2016/01/13 09:44:46
#include "base/macros.h" for this macro.
melandory
2016/01/13 15:11:36
Done.
| |
72 }; | |
73 | |
74 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ | |
OLD | NEW |