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_PASSWORD_MANAGER_INFOBAR_DELEGAT
E_H_ | 5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_PASSWORD_MANAGER_INFOBAR_DELEGAT
E_H_ |
6 #define IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_PASSWORD_MANAGER_INFOBAR_DELEGAT
E_H_ | 6 #define IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_PASSWORD_MANAGER_INFOBAR_DELEGAT
E_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
11 #include "components/infobars/core/confirm_infobar_delegate.h" | 12 #include "components/infobars/core/confirm_infobar_delegate.h" |
12 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 13 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
13 | 14 |
14 namespace password_manager { | 15 namespace password_manager { |
15 class PasswordFormManager; | 16 class PasswordFormManager; |
16 } | 17 } |
17 | 18 |
18 // Base class for password manager infobar delegates, e.g. | 19 // Base class for password manager infobar delegates, e.g. |
19 // IOSChromeSavePasswordInfoBarDelegate and | 20 // IOSChromeSavePasswordInfoBarDelegate and |
20 // IOSChromeUpdatePasswordInfoBarDelegate. Provides link text and action for | 21 // IOSChromeUpdatePasswordInfoBarDelegate. Provides link text and action for |
21 // smart lock. | 22 // smart lock. |
22 class IOSChromePasswordManagerInfoBarDelegate : public ConfirmInfoBarDelegate { | 23 class IOSChromePasswordManagerInfoBarDelegate : public ConfirmInfoBarDelegate { |
23 public: | 24 public: |
24 ~IOSChromePasswordManagerInfoBarDelegate() override; | 25 ~IOSChromePasswordManagerInfoBarDelegate() override; |
25 | 26 |
26 protected: | 27 protected: |
27 IOSChromePasswordManagerInfoBarDelegate( | 28 IOSChromePasswordManagerInfoBarDelegate( |
28 bool is_smart_lock_branding_enabled, | 29 bool is_smart_lock_branding_enabled, |
29 std::unique_ptr<password_manager::PasswordFormManager> form_manager); | 30 scoped_refptr<password_manager::PasswordFormManager> form_manager); |
30 | 31 |
31 password_manager::PasswordFormManager* form_to_save() const { | 32 password_manager::PasswordFormManager* form_to_save() const { |
32 return form_to_save_.get(); | 33 return form_to_save_.get(); |
33 } | 34 } |
34 | 35 |
35 bool is_smart_lock_branding_enabled() const { | 36 bool is_smart_lock_branding_enabled() const { |
36 return is_smart_lock_branding_enabled_; | 37 return is_smart_lock_branding_enabled_; |
37 } | 38 } |
38 | 39 |
39 void set_infobar_response( | 40 void set_infobar_response( |
40 password_manager::metrics_util::UIDismissalReason response) { | 41 password_manager::metrics_util::UIDismissalReason response) { |
41 infobar_response_ = response; | 42 infobar_response_ = response; |
42 } | 43 } |
43 | 44 |
44 private: | 45 private: |
45 // ConfirmInfoBarDelegate implementation. | 46 // ConfirmInfoBarDelegate implementation. |
46 Type GetInfoBarType() const override; | 47 Type GetInfoBarType() const override; |
47 base::string16 GetLinkText() const override; | 48 base::string16 GetLinkText() const override; |
48 int GetIconId() const override; | 49 int GetIconId() const override; |
49 bool LinkClicked(WindowOpenDisposition disposition) override; | 50 bool LinkClicked(WindowOpenDisposition disposition) override; |
50 | 51 |
51 // The password_manager::PasswordFormManager managing the form we're asking | 52 // The password_manager::PasswordFormManager managing the form we're asking |
52 // the user about, and should save as per their decision. | 53 // the user about, and should save as per their decision. |
53 std::unique_ptr<password_manager::PasswordFormManager> form_to_save_; | 54 scoped_refptr<password_manager::PasswordFormManager> form_to_save_; |
54 | 55 |
55 // Used to track the results we get from the info bar. | 56 // Used to track the results we get from the info bar. |
56 password_manager::metrics_util::UIDismissalReason infobar_response_; | 57 password_manager::metrics_util::UIDismissalReason infobar_response_; |
57 | 58 |
58 // Whether to show the password manager branded as Smart Lock. | 59 // Whether to show the password manager branded as Smart Lock. |
59 const bool is_smart_lock_branding_enabled_; | 60 const bool is_smart_lock_branding_enabled_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(IOSChromePasswordManagerInfoBarDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(IOSChromePasswordManagerInfoBarDelegate); |
62 }; | 63 }; |
63 #endif // IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_PASSWORD_MANAGER_INFOBAR_DELE
GATE_H_ | 64 #endif // IOS_CHROME_BROWSER_PASSWORDS_IOS_CHROME_PASSWORD_MANAGER_INFOBAR_DELE
GATE_H_ |
OLD | NEW |