| 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 "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 SetMessageLinkRange(message_link_range); | 114 SetMessageLinkRange(message_link_range); |
| 115 } | 115 } |
| 116 | 116 |
| 117 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() { | 117 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() { |
| 118 return should_show_first_run_experience_ | 118 return should_show_first_run_experience_ |
| 119 ? l10n_util::GetStringUTF16( | 119 ? l10n_util::GetStringUTF16( |
| 120 IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE) | 120 IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE) |
| 121 : base::string16(); | 121 : base::string16(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 infobars::InfoBarDelegate::InfoBarIdentifier |
| 125 SavePasswordInfoBarDelegate::GetIdentifier() const { |
| 126 return SAVE_PASSWORD_INFOBAR_DELEGATE_ID; |
| 127 } |
| 128 |
| 124 void SavePasswordInfoBarDelegate::InfoBarDismissed() { | 129 void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
| 125 DCHECK(form_to_save_.get()); | 130 DCHECK(form_to_save_.get()); |
| 126 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; | 131 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; |
| 127 } | 132 } |
| 128 | 133 |
| 129 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( | 134 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( |
| 130 InfoBarButton button) const { | 135 InfoBarButton button) const { |
| 131 return l10n_util::GetStringUTF16((button == BUTTON_OK) | 136 return l10n_util::GetStringUTF16((button == BUTTON_OK) |
| 132 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON | 137 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON |
| 133 : GetCancelButtonText(source_type_)); | 138 : GetCancelButtonText(source_type_)); |
| 134 } | 139 } |
| 135 | 140 |
| 136 bool SavePasswordInfoBarDelegate::Accept() { | 141 bool SavePasswordInfoBarDelegate::Accept() { |
| 137 DCHECK(form_to_save_.get()); | 142 DCHECK(form_to_save_.get()); |
| 138 form_to_save_->Save(); | 143 form_to_save_->Save(); |
| 139 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; | 144 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; |
| 140 return true; | 145 return true; |
| 141 } | 146 } |
| 142 | 147 |
| 143 bool SavePasswordInfoBarDelegate::Cancel() { | 148 bool SavePasswordInfoBarDelegate::Cancel() { |
| 144 DCHECK(form_to_save_.get()); | 149 DCHECK(form_to_save_.get()); |
| 145 form_to_save_->PermanentlyBlacklist(); | 150 form_to_save_->PermanentlyBlacklist(); |
| 146 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; | 151 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; |
| 147 return true; | 152 return true; |
| 148 } | 153 } |
| OLD | NEW |