OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEGATE
_H_ | 5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEGATE
_H_ |
6 #define IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEGATE
_H_ | 6 #define IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEGATE
_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_deleg
ate.h" | 11 #include "ios/chrome/browser/passwords/ios_chrome_password_manager_infobar_deleg
ate.h" |
12 | 12 |
13 namespace password_manager { | 13 namespace password_manager { |
14 class PasswordFormManager; | 14 class PasswordFormManager; |
15 } | 15 } |
16 | 16 |
17 namespace infobars { | 17 namespace infobars { |
18 class InfoBarManager; | 18 class InfoBarManager; |
19 } | 19 } |
20 @class NSArray; | 20 @class NSArray; |
21 | 21 |
22 class IOSChromeUpdatePasswordInfoBarDelegate | 22 class IOSChromeUpdatePasswordInfoBarDelegate |
23 : public IOSChromePasswordManagerInfoBarDelegate { | 23 : public IOSChromePasswordManagerInfoBarDelegate { |
24 public: | 24 public: |
25 // Creates the infobar for |form_to_save| and adds it to |infobar_manager|. | 25 // Creates the infobar for |form_to_save| and adds it to |infobar_manager|. |
26 // |is_smart_lock_enabled| controls the branding string. | 26 // |is_smart_lock_enabled| controls the branding string. |
27 static void Create( | 27 static void Create( |
28 bool is_smart_lock_branding_enabled, | 28 bool is_smart_lock_branding_enabled, |
29 infobars::InfoBarManager* infobar_manager, | 29 infobars::InfoBarManager* infobar_manager, |
30 std::unique_ptr<password_manager::PasswordFormManager> form_to_save); | 30 scoped_refptr<password_manager::PasswordFormManager> form_to_save); |
31 | 31 |
32 ~IOSChromeUpdatePasswordInfoBarDelegate() override; | 32 ~IOSChromeUpdatePasswordInfoBarDelegate() override; |
33 | 33 |
34 // Returns whether the user has multiple saved credentials, of which the | 34 // Returns whether the user has multiple saved credentials, of which the |
35 // infobar affects just one. If so, the infobar should clarify which | 35 // infobar affects just one. If so, the infobar should clarify which |
36 // credential is being affected. | 36 // credential is being affected. |
37 bool ShowMultipleAccounts() const; | 37 bool ShowMultipleAccounts() const; |
38 | 38 |
39 // Returns an array of credentials. Applicable if the user has multiple | 39 // Returns an array of credentials. Applicable if the user has multiple |
40 // saved credentials for the site |form_to_save| is applied to. | 40 // saved credentials for the site |form_to_save| is applied to. |
41 NSArray* GetAccounts() const; | 41 NSArray* GetAccounts() const; |
42 | 42 |
43 base::string16 selected_account() const { return selected_account_; } | 43 base::string16 selected_account() const { return selected_account_; } |
44 | 44 |
45 void set_selected_account(base::string16 account) { | 45 void set_selected_account(base::string16 account) { |
46 selected_account_ = account; | 46 selected_account_ = account; |
47 }; | 47 }; |
48 | 48 |
49 private: | 49 private: |
50 IOSChromeUpdatePasswordInfoBarDelegate( | 50 IOSChromeUpdatePasswordInfoBarDelegate( |
51 bool is_smart_lock_branding_enabled, | 51 bool is_smart_lock_branding_enabled, |
52 std::unique_ptr<password_manager::PasswordFormManager> form_to_save); | 52 scoped_refptr<password_manager::PasswordFormManager> form_to_save); |
53 | 53 |
54 // Returns the string with the branded title of the password manager (e.g. | 54 // Returns the string with the branded title of the password manager (e.g. |
55 // "Google Smart Lock for Passwords"). | 55 // "Google Smart Lock for Passwords"). |
56 base::string16 GetBranding() const; | 56 base::string16 GetBranding() const; |
57 | 57 |
58 // ConfirmInfoBarDelegate implementation. | 58 // ConfirmInfoBarDelegate implementation. |
59 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 59 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
60 base::string16 GetMessageText() const override; | 60 base::string16 GetMessageText() const override; |
61 int GetButtons() const override; | 61 int GetButtons() const override; |
62 base::string16 GetButtonLabel(InfoBarButton button) const override; | 62 base::string16 GetButtonLabel(InfoBarButton button) const override; |
63 bool Accept() override; | 63 bool Accept() override; |
64 | 64 |
65 // The credential that should be displayed in the infobar, and for which the | 65 // The credential that should be displayed in the infobar, and for which the |
66 // password will be updated. | 66 // password will be updated. |
67 base::string16 selected_account_; | 67 base::string16 selected_account_; |
68 }; | 68 }; |
69 | 69 |
70 #endif // IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEG
ATE_H_ | 70 #endif // IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_UPDATE_PASSWORD_INFOBAR_DELEG
ATE_H_ |
OLD | NEW |