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

Side by Side Diff: chrome/browser/password_manager/update_password_infobar_delegate.h

Issue 1490193003: [Password Manager] Update Confirmation UI for saved password change for Chrome on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
(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 // If PasswordManager encounters the login which is already known or user fills
21 // the password change form, then user is prompted with an infobar asking if
22 // already saved credentials should be updated or not.
23 // In case several credentials are stored for the web site, user can choose
24 // which one should be updated.
25 class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate {
26 public:
27 static void Create(
28 content::WebContents* web_contents,
29 scoped_ptr<password_manager::PasswordFormManager> form_to_update);
30
31 ~UpdatePasswordInfoBarDelegate() override;
32
33 base::string16 branding() const { return branding_; }
34
35 bool is_smartlock_branding_enabled() const {
36 return is_smartlock_branding_enabled_;
37 }
38
39 // Returns true if infobar for the multi credentials case should be shown, e.g
40 // user changing a password on a password change form and has several
41 // credentials save for the web site.
42 bool ShowMultipleAccounts() const;
43
44 const std::vector<const autofill::PasswordForm*>& GetCurrentForms() const {
45 return passwords_data_.GetCurrentForms();
46 }
47
48 // Returns the username of the saved credentials in case when there is only
49 // one credential pair stored.
50 base::string16 GetUsernameForOneAccountCase();
51
52 // Updates either pending credentials of form with |form_index| in case
53 // multiple
gone 2016/01/26 19:59:22 nit: Indentation is wonky.
melandory 2016/01/29 15:56:14 Done.
54 // choice available.
55 void UpdatePassword(int form_index);
56
57 // ConfirmInfoBarDelegate:
58 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
59 base::string16 GetButtonLabel(InfoBarButton button) const override;
60 bool Accept() override;
61 bool Cancel() override;
62
63 private:
64 UpdatePasswordInfoBarDelegate(
65 content::WebContents* web_contents,
66 scoped_ptr<password_manager::PasswordFormManager> form_to_update,
67 bool is_smartlock_branding_enabled);
68
69 // Updates the pending credentials.
70 void UpdatePasswordWithPending();
71
72 // Updates the form with index |form_index| in case of multiple credentials.
73 void UpdatePasswordWithCurrentForm(int form_index);
74
75 ManagePasswordsState passwords_data_;
76 base::string16 branding_;
77 bool is_smartlock_branding_enabled_;
78
79 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate);
80 };
81
82 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698