| 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 std::string SavePasswordInfoBarDelegate::GetIdentifier() const { |
| 125 return "SavePasswordInfoBarDelegate"; |
| 126 } |
| 127 |
| 124 void SavePasswordInfoBarDelegate::InfoBarDismissed() { | 128 void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
| 125 DCHECK(form_to_save_.get()); | 129 DCHECK(form_to_save_.get()); |
| 126 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; | 130 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; |
| 127 } | 131 } |
| 128 | 132 |
| 129 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( | 133 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( |
| 130 InfoBarButton button) const { | 134 InfoBarButton button) const { |
| 131 return l10n_util::GetStringUTF16((button == BUTTON_OK) | 135 return l10n_util::GetStringUTF16((button == BUTTON_OK) |
| 132 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON | 136 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON |
| 133 : GetCancelButtonText(source_type_)); | 137 : GetCancelButtonText(source_type_)); |
| 134 } | 138 } |
| 135 | 139 |
| 136 bool SavePasswordInfoBarDelegate::Accept() { | 140 bool SavePasswordInfoBarDelegate::Accept() { |
| 137 DCHECK(form_to_save_.get()); | 141 DCHECK(form_to_save_.get()); |
| 138 form_to_save_->Save(); | 142 form_to_save_->Save(); |
| 139 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; | 143 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; |
| 140 return true; | 144 return true; |
| 141 } | 145 } |
| 142 | 146 |
| 143 bool SavePasswordInfoBarDelegate::Cancel() { | 147 bool SavePasswordInfoBarDelegate::Cancel() { |
| 144 DCHECK(form_to_save_.get()); | 148 DCHECK(form_to_save_.get()); |
| 145 form_to_save_->PermanentlyBlacklist(); | 149 form_to_save_->PermanentlyBlacklist(); |
| 146 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; | 150 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; |
| 147 return true; | 151 return true; |
| 148 } | 152 } |
| OLD | NEW |