OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Type GetInfoBarType() const override; | 50 Type GetInfoBarType() const override; |
51 InfoBarAutomationType GetInfoBarAutomationType() const override; | 51 InfoBarAutomationType GetInfoBarAutomationType() const override; |
52 int GetIconID() const override; | 52 int GetIconID() const override; |
53 bool ShouldExpire(const NavigationDetails& details) const override; | 53 bool ShouldExpire(const NavigationDetails& details) const override; |
54 void InfoBarDismissed() override; | 54 void InfoBarDismissed() override; |
55 base::string16 GetMessageText() const override; | 55 base::string16 GetMessageText() const override; |
56 base::string16 GetButtonLabel(InfoBarButton button) const override; | 56 base::string16 GetButtonLabel(InfoBarButton button) const override; |
57 bool Accept() override; | 57 bool Accept() override; |
58 bool Cancel() override; | 58 bool Cancel() override; |
59 | 59 |
60 private: | 60 protected: |
| 61 // Makes a ctor available in tests. |
61 SavePasswordInfoBarDelegate( | 62 SavePasswordInfoBarDelegate( |
62 scoped_ptr<password_manager::PasswordFormManager> form_to_save, | 63 scoped_ptr<password_manager::PasswordFormManager> form_to_save, |
63 const std::string& uma_histogram_suffix, | 64 const std::string& uma_histogram_suffix, |
64 password_manager::CredentialSourceType source_type); | 65 password_manager::CredentialSourceType source_type); |
65 | 66 |
| 67 private: |
66 // The PasswordFormManager managing the form we're asking the user about, | 68 // The PasswordFormManager managing the form we're asking the user about, |
67 // and should update as per her decision. | 69 // and should update as per her decision. |
68 scoped_ptr<password_manager::PasswordFormManager> form_to_save_; | 70 scoped_ptr<password_manager::PasswordFormManager> form_to_save_; |
69 | 71 |
70 // Used to track the results we get from the info bar. | 72 // Used to track the results we get from the info bar. |
71 password_manager::metrics_util::ResponseType infobar_response_; | 73 password_manager::metrics_util::ResponseType infobar_response_; |
72 | 74 |
73 // Measures the "Save password?" prompt lifetime. Used to report an UMA | 75 // Measures the "Save password?" prompt lifetime. Used to report an UMA |
74 // signal. | 76 // signal. |
75 base::ElapsedTimer timer_; | 77 base::ElapsedTimer timer_; |
76 | 78 |
77 // The group name corresponding to the domain name of |form_to_save_| if the | 79 // The group name corresponding to the domain name of |form_to_save_| if the |
78 // form is on a monitored domain. Otherwise, an empty string. | 80 // form is on a monitored domain. Otherwise, an empty string. |
79 const std::string uma_histogram_suffix_; | 81 const std::string uma_histogram_suffix_; |
80 | 82 |
81 // Records source from where infobar was triggered. | 83 // Records source from where infobar was triggered. |
82 // Infobar appearance (title, buttons) depends on value of this parameter. | 84 // Infobar appearance (title, buttons) depends on value of this parameter. |
83 password_manager::CredentialSourceType source_type_; | 85 password_manager::CredentialSourceType source_type_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); | 87 DISALLOW_COPY_AND_ASSIGN(SavePasswordInfoBarDelegate); |
86 }; | 88 }; |
87 | 89 |
88 #endif // CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ | 90 #endif // CHROME_BROWSER_PASSWORD_MANAGER_SAVE_PASSWORD_INFOBAR_DELEGATE_H_ |
OLD | NEW |