1 // Copyright 2015 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.
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_INFOBAR_DELEGATE_ANDROID_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_INFOBAR_DELEGATE_ANDROID_H_
8 #include "base/macros.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
10 #include "components/infobars/core/infobar_delegate.h"
11 #include "ui/gfx/range/range.h"
13 namespace password_manager
{
14 enum class CredentialType
;
25 // Android-only infobar delegate to allow user to choose credentials for login.
26 class AccountChooserInfoBarDelegateAndroid
: public infobars::InfoBarDelegate
{
28 // Creates an account chooser infobar and delegate and adds the infobar to
30 static void Create(content::WebContents
* web_contents
,
31 ManagePasswordsUIController
* ui_controller
);
33 ~AccountChooserInfoBarDelegateAndroid() override
;
35 const std::vector
<const autofill::PasswordForm
*>&
36 local_credentials_forms() const {
37 return ui_controller_
->GetCurrentForms();
40 const std::vector
<const autofill::PasswordForm
*>&
41 federated_credentials_forms() const {
42 return ui_controller_
->GetFederatedForms();
45 void ChooseCredential(size_t credential_index
,
46 password_manager::CredentialType credential_type
);
48 // Returns the translated text of the message to display.
49 const base::string16
& message() const { return message_
; }
51 // Returns the range of the message text that should be a link.
52 const gfx::Range
& message_link_range() const { return message_link_range_
; }
57 explicit AccountChooserInfoBarDelegateAndroid(
58 content::WebContents
* web_contents
,
59 ManagePasswordsUIController
* ui_controller
);
61 // infobars::InfoBarDelegate:
62 void InfoBarDismissed() override
;
63 Type
GetInfoBarType() const override
;
65 // Owned by WebContents.
66 ManagePasswordsUIController
* ui_controller_
;
68 // Title for the infobar: branded as a part of Google Smart Lock for signed
70 base::string16 message_
;
72 // If set, describes the location of the link.
73 gfx::Range message_link_range_
;
75 DISALLOW_COPY_AND_ASSIGN(AccountChooserInfoBarDelegateAndroid
);
78 #endif // CHROME_BROWSER_PASSWORD_MANAGER_ACCOUNT_CHOOSER_INFOBAR_DELEGATE_ANDROID_H_