Chromium Code Reviews| 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 // 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. | |
|
Peter Kasting
2016/02/13 01:44:52
Nit: Grammar. How about:
An infobar delegate whi
melandory
2016/02/22 12:41:09
Done.
| |
| 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 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 | |
| 45 // Returns the username of the saved credentials in the case when there is | |
| 46 // only one credential pair stored. | |
| 47 base::string16 GetUsernameForOneAccountCase(); | |
|
Peter Kasting
2016/02/13 01:44:52
Nit: One -> Single
melandory
2016/02/22 12:41:09
Done.
| |
| 48 | |
| 49 private: | |
| 50 UpdatePasswordInfoBarDelegate( | |
| 51 content::WebContents* web_contents, | |
| 52 scoped_ptr<password_manager::PasswordFormManager> form_to_update, | |
| 53 bool is_smartlock_branding_enabled); | |
| 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 ManagePasswordsState passwords_data_; | |
| 62 base::string16 branding_; | |
| 63 bool is_smartlock_branding_enabled_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate); | |
| 66 }; | |
| 67 | |
| 68 #endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |