Index: chrome/browser/password_manager/update_password_infobar_delegate.h |
diff --git a/chrome/browser/password_manager/update_password_infobar_delegate.h b/chrome/browser/password_manager/update_password_infobar_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bdc12a7de65cb36c1c019478f65b9e325267d272 |
--- /dev/null |
+++ b/chrome/browser/password_manager/update_password_infobar_delegate.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ |
+#define CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ |
+ |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/password_manager/password_manager_infobar_delegate.h" |
+#include "chrome/browser/ui/passwords/manage_passwords_state.h" |
+#include "components/password_manager/core/browser/password_form_manager.h" |
+ |
+namespace content { |
+class WebContents; |
+} |
+ |
+// An infobar delegate which asks the user if the password should be updated for |
+// 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.
|
+// set of saved credentials for a site. If several such sets are present, the |
+// user |
+// can choose which one to update. PasswordManager displays this infobar when |
+// the |
+// user signs into the site with a new password for a known username or fills in |
+// a |
+// password change form. |
+class UpdatePasswordInfoBarDelegate : public PasswordManagerInfoBarDelegate { |
+ public: |
+ static void Create( |
+ content::WebContents* web_contents, |
+ scoped_ptr<password_manager::PasswordFormManager> form_to_update); |
+ |
+ ~UpdatePasswordInfoBarDelegate() override; |
+ |
+ base::string16 branding() const { return branding_; } |
+ bool is_smartlock_branding_enabled() const { |
+ return is_smartlock_branding_enabled_; |
+ } |
+ |
+ // Returns true if infobar for the multi credentials case should be shown, e.g |
+ // user changing a password on a password change form and has several |
+ // 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.
|
+ bool ShowMultipleAccounts() const; |
+ |
+ 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.
|
+ |
+ // Returns the username of the saved credentials in the case when there is |
+ // only one credential pair stored. |
+ base::string16 GetUsernameForSingleAccountCase(); |
+ |
+ private: |
+ UpdatePasswordInfoBarDelegate( |
+ content::WebContents* web_contents, |
+ scoped_ptr<password_manager::PasswordFormManager> form_to_update, |
+ bool is_smartlock_branding_enabled); |
+ |
+ // ConfirmInfoBarDelegate: |
+ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
+ base::string16 GetButtonLabel(InfoBarButton button) const override; |
+ bool Accept() override; |
+ bool Cancel() override; |
+ |
+ 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.
|
+ base::string16 branding_; |
+ bool is_smartlock_branding_enabled_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(UpdatePasswordInfoBarDelegate); |
+}; |
+ |
+#endif // CHROME_BROWSER_PASSWORD_MANAGER_UPDATE_PASSWORD_INFOBAR_DELEGATE_H_ |