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 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" | 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/infobars/infobar.h" | |
10 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 10 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 11 #include "components/infobars/core/infobar.h" |
12 #include "components/password_manager/core/browser/password_form_manager.h" | 12 #include "components/password_manager/core/browser/password_form_manager.h" |
13 #include "components/signin/core/common/profile_management_switches.h" | 13 #include "components/signin/core/common/profile_management_switches.h" |
14 #include "content/public/browser/navigation_entry.h" | 14 #include "content/public/browser/navigation_entry.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "google_apis/gaia/gaia_urls.h" | 16 #include "google_apis/gaia/gaia_urls.h" |
17 #include "grit/chromium_strings.h" | 17 #include "grit/chromium_strings.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 | 21 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 96 } |
97 | 97 |
98 #if !defined(OS_ANDROID) | 98 #if !defined(OS_ANDROID) |
99 // On Android, the save password infobar supports an additional checkbox to | 99 // On Android, the save password infobar supports an additional checkbox to |
100 // require additional authentication before autofilling a saved password. | 100 // require additional authentication before autofilling a saved password. |
101 // Because of this non-standard UI, the Android version is special cased and | 101 // Because of this non-standard UI, the Android version is special cased and |
102 // constructed in: | 102 // constructed in: |
103 // chrome/browser/ui/android/infobars/save_password_infobar.cc | 103 // chrome/browser/ui/android/infobars/save_password_infobar.cc |
104 | 104 |
105 // static | 105 // static |
106 scoped_ptr<InfoBar> SavePasswordInfoBarDelegate::CreateInfoBar( | 106 scoped_ptr<infobars::InfoBar> SavePasswordInfoBarDelegate::CreateInfoBar( |
107 scoped_ptr<SavePasswordInfoBarDelegate> delegate) { | 107 scoped_ptr<SavePasswordInfoBarDelegate> delegate) { |
108 return ConfirmInfoBarDelegate::CreateInfoBar( | 108 return ConfirmInfoBarDelegate::CreateInfoBar( |
109 delegate.PassAs<ConfirmInfoBarDelegate>()); | 109 delegate.PassAs<ConfirmInfoBarDelegate>()); |
110 } | 110 } |
111 #endif | 111 #endif |
112 | 112 |
113 bool SavePasswordInfoBarDelegate::ShouldExpire( | 113 bool SavePasswordInfoBarDelegate::ShouldExpire( |
114 const NavigationDetails& details) const { | 114 const NavigationDetails& details) const { |
115 return !details.is_redirect && InfoBarDelegate::ShouldExpire(details); | 115 return !details.is_redirect && |
| 116 infobars::InfoBarDelegate::ShouldExpire(details); |
116 } | 117 } |
117 | 118 |
118 int SavePasswordInfoBarDelegate::GetIconID() const { | 119 int SavePasswordInfoBarDelegate::GetIconID() const { |
119 return IDR_INFOBAR_SAVE_PASSWORD; | 120 return IDR_INFOBAR_SAVE_PASSWORD; |
120 } | 121 } |
121 | 122 |
122 InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() const { | 123 infobars::InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType() |
| 124 const { |
123 return PAGE_ACTION_TYPE; | 125 return PAGE_ACTION_TYPE; |
124 } | 126 } |
125 | 127 |
126 base::string16 SavePasswordInfoBarDelegate::GetMessageText() const { | 128 base::string16 SavePasswordInfoBarDelegate::GetMessageText() const { |
127 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); | 129 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); |
128 } | 130 } |
129 | 131 |
130 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( | 132 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( |
131 InfoBarButton button) const { | 133 InfoBarButton button) const { |
132 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 134 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
(...skipping 12 matching lines...) Expand all Loading... |
145 form_to_save_->PermanentlyBlacklist(); | 147 form_to_save_->PermanentlyBlacklist(); |
146 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; | 148 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; |
147 return true; | 149 return true; |
148 } | 150 } |
149 | 151 |
150 void SavePasswordInfoBarDelegate::InfoBarDismissed() { | 152 void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
151 DCHECK(form_to_save_.get()); | 153 DCHECK(form_to_save_.get()); |
152 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; | 154 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; |
153 } | 155 } |
154 | 156 |
155 InfoBarDelegate::InfoBarAutomationType | 157 infobars::InfoBarDelegate::InfoBarAutomationType |
156 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { | 158 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const { |
157 return PASSWORD_INFOBAR; | 159 return PASSWORD_INFOBAR; |
158 } | 160 } |
OLD | NEW |