Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/password_manager/update_password_infobar_delegate_android.cc

Issue 2298733003: Removing Nope button in Update password prompt according to mocks. (Closed)
Patch Set: Remove Cancel Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 passwords_state_.set_client( 75 passwords_state_.set_client(
76 ChromePasswordManagerClient::FromWebContents(web_contents)); 76 ChromePasswordManagerClient::FromWebContents(web_contents));
77 passwords_state_.OnUpdatePassword(std::move(form_to_update)); 77 passwords_state_.OnUpdatePassword(std::move(form_to_update));
78 } 78 }
79 79
80 infobars::InfoBarDelegate::InfoBarIdentifier 80 infobars::InfoBarDelegate::InfoBarIdentifier
81 UpdatePasswordInfoBarDelegate::GetIdentifier() const { 81 UpdatePasswordInfoBarDelegate::GetIdentifier() const {
82 return UPDATE_PASSWORD_INFOBAR_DELEGATE; 82 return UPDATE_PASSWORD_INFOBAR_DELEGATE;
83 } 83 }
84 84
85 int UpdatePasswordInfoBarDelegate::GetButtons() const {
86 return BUTTON_OK;
87 }
88
85 base::string16 UpdatePasswordInfoBarDelegate::GetButtonLabel( 89 base::string16 UpdatePasswordInfoBarDelegate::GetButtonLabel(
86 InfoBarButton button) const { 90 InfoBarButton button) const {
87 return l10n_util::GetStringUTF16((button == BUTTON_OK) 91 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON);
88 ? IDS_PASSWORD_MANAGER_UPDATE_BUTTON
89 : IDS_PASSWORD_MANAGER_CANCEL_BUTTON);
90 } 92 }
91 93
92 bool UpdatePasswordInfoBarDelegate::Accept() { 94 bool UpdatePasswordInfoBarDelegate::Accept() {
93 UpdatePasswordInfoBar* update_password_infobar = 95 UpdatePasswordInfoBar* update_password_infobar =
94 static_cast<UpdatePasswordInfoBar*>(infobar()); 96 static_cast<UpdatePasswordInfoBar*>(infobar());
95 password_manager::PasswordFormManager* form_manager = 97 password_manager::PasswordFormManager* form_manager =
96 passwords_state_.form_manager(); 98 passwords_state_.form_manager();
97 if (ShowMultipleAccounts()) { 99 if (ShowMultipleAccounts()) {
98 int form_index = update_password_infobar->GetIdOfSelectedUsername(); 100 int form_index = update_password_infobar->GetIdOfSelectedUsername();
99 DCHECK_GE(form_index, 0); 101 DCHECK_GE(form_index, 0);
100 DCHECK_LT(static_cast<size_t>(form_index), GetCurrentForms().size()); 102 DCHECK_LT(static_cast<size_t>(form_index), GetCurrentForms().size());
101 form_manager->Update(*GetCurrentForms()[form_index]); 103 form_manager->Update(*GetCurrentForms()[form_index]);
102 } else { 104 } else {
103 form_manager->Update(form_manager->pending_credentials()); 105 form_manager->Update(form_manager->pending_credentials());
104 } 106 }
105 return true; 107 return true;
106 } 108 }
107
108 bool UpdatePasswordInfoBarDelegate::Cancel() {
109 return true;
110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698