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