| 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 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 5 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 10 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const std::vector<const autofill::PasswordForm*>& | 55 const std::vector<const autofill::PasswordForm*>& |
| 56 UpdatePasswordInfoBarDelegate::GetCurrentForms() const { | 56 UpdatePasswordInfoBarDelegate::GetCurrentForms() const { |
| 57 return passwords_state_.GetCurrentForms(); | 57 return passwords_state_.GetCurrentForms(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 UpdatePasswordInfoBarDelegate::UpdatePasswordInfoBarDelegate( | 60 UpdatePasswordInfoBarDelegate::UpdatePasswordInfoBarDelegate( |
| 61 content::WebContents* web_contents, | 61 content::WebContents* web_contents, |
| 62 std::unique_ptr<password_manager::PasswordFormManager> form_to_update, | 62 std::unique_ptr<password_manager::PasswordFormManager> form_to_update, |
| 63 bool is_smartlock_branding_enabled) | 63 bool is_smartlock_branding_enabled) |
| 64 : is_smartlock_branding_enabled_(is_smartlock_branding_enabled) { | 64 : is_smartlock_branding_enabled_(is_smartlock_branding_enabled) { |
| 65 base::string16 message; |
| 66 gfx::Range message_link_range = gfx::Range(); |
| 67 GetSavePasswordDialogTitleTextAndLinkRange( |
| 68 web_contents->GetVisibleURL(), form_to_update->observed_form().origin, |
| 69 is_smartlock_branding_enabled, PasswordTittleType::UPDATE_PASSWORD, |
| 70 &message, &message_link_range); |
| 71 SetMessage(message); |
| 72 SetMessageLinkRange(message_link_range); |
| 73 |
| 65 // TODO(melandory): Add histograms, crbug.com/577129 | 74 // TODO(melandory): Add histograms, crbug.com/577129 |
| 66 passwords_state_.set_client( | 75 passwords_state_.set_client( |
| 67 ChromePasswordManagerClient::FromWebContents(web_contents)); | 76 ChromePasswordManagerClient::FromWebContents(web_contents)); |
| 68 passwords_state_.OnUpdatePassword(std::move(form_to_update)); | 77 passwords_state_.OnUpdatePassword(std::move(form_to_update)); |
| 69 } | 78 } |
| 70 | 79 |
| 71 infobars::InfoBarDelegate::InfoBarIdentifier | 80 infobars::InfoBarDelegate::InfoBarIdentifier |
| 72 UpdatePasswordInfoBarDelegate::GetIdentifier() const { | 81 UpdatePasswordInfoBarDelegate::GetIdentifier() const { |
| 73 return UPDATE_PASSWORD_INFOBAR_DELEGATE; | 82 return UPDATE_PASSWORD_INFOBAR_DELEGATE; |
| 74 } | 83 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 form_manager->Update(*GetCurrentForms()[form_index]); | 101 form_manager->Update(*GetCurrentForms()[form_index]); |
| 93 } else { | 102 } else { |
| 94 form_manager->Update(form_manager->pending_credentials()); | 103 form_manager->Update(form_manager->pending_credentials()); |
| 95 } | 104 } |
| 96 return true; | 105 return true; |
| 97 } | 106 } |
| 98 | 107 |
| 99 bool UpdatePasswordInfoBarDelegate::Cancel() { | 108 bool UpdatePasswordInfoBarDelegate::Cancel() { |
| 100 return true; | 109 return true; |
| 101 } | 110 } |
| OLD | NEW |