| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/passwords/manage_passwords_bubble_view.h" | 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/timer/timer.h" | 7 #include "base/timer/timer.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 SetLayoutManager(layout); | 1020 SetLayoutManager(layout); |
| 1021 | 1021 |
| 1022 // Create the pending credential item, update button. | 1022 // Create the pending credential item, update button. |
| 1023 View* item = nullptr; | 1023 View* item = nullptr; |
| 1024 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { | 1024 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { |
| 1025 selection_view_ = new CredentialsSelectionView( | 1025 selection_view_ = new CredentialsSelectionView( |
| 1026 parent->model(), parent->model()->local_credentials().get(), | 1026 parent->model(), parent->model()->local_credentials().get(), |
| 1027 parent->model()->pending_password().username_value); | 1027 parent->model()->pending_password().username_value); |
| 1028 item = selection_view_; | 1028 item = selection_view_; |
| 1029 } else { | 1029 } else { |
| 1030 DCHECK_EQ(1u, parent->model()->local_credentials().size()); | 1030 // |pending_password()| is a form that should be updated, so it should be |
| 1031 DCHECK_EQ(parent->model()->local_credentials()[0]->username_value, | 1031 // used when the user clicks "Update". |
| 1032 parent->model()->pending_password().username_value); | |
| 1033 std::vector<const autofill::PasswordForm*> forms; | 1032 std::vector<const autofill::PasswordForm*> forms; |
| 1034 forms.push_back(&parent->model()->pending_password()); | 1033 forms.push_back(&parent->model()->pending_password()); |
| 1035 item = new ManagePasswordItemsView(parent_->model(), forms); | 1034 item = new ManagePasswordItemsView(parent_->model(), forms); |
| 1036 } | 1035 } |
| 1037 nope_button_ = new views::LabelButton( | 1036 nope_button_ = new views::LabelButton( |
| 1038 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); | 1037 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); |
| 1039 nope_button_->SetStyle(views::Button::STYLE_BUTTON); | 1038 nope_button_->SetStyle(views::Button::STYLE_BUTTON); |
| 1040 nope_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 1039 nope_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
| 1041 ui::ResourceBundle::SmallFont)); | 1040 ui::ResourceBundle::SmallFont)); |
| 1042 | 1041 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1084 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( | 1083 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( |
| 1085 views::Button* sender, | 1084 views::Button* sender, |
| 1086 const ui::Event& event) { | 1085 const ui::Event& event) { |
| 1087 DCHECK(sender == update_button_ || sender == nope_button_); | 1086 DCHECK(sender == update_button_ || sender == nope_button_); |
| 1088 if (sender == update_button_) { | 1087 if (sender == update_button_) { |
| 1089 if (selection_view_) { | 1088 if (selection_view_) { |
| 1090 // Multi account case. | 1089 // Multi account case. |
| 1091 parent_->model()->OnUpdateClicked( | 1090 parent_->model()->OnUpdateClicked( |
| 1092 *selection_view_->GetSelectedCredentials()); | 1091 *selection_view_->GetSelectedCredentials()); |
| 1093 } else { | 1092 } else { |
| 1094 parent_->model()->OnUpdateClicked( | 1093 parent_->model()->OnUpdateClicked(parent_->model()->pending_password()); |
| 1095 *parent_->model()->local_credentials()[0]); | |
| 1096 } | 1094 } |
| 1095 } else { |
| 1096 parent_->model()->OnNopeUpdateClicked(); |
| 1097 } | 1097 } |
| 1098 parent_->Close(); | 1098 parent_->Close(); |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked( | 1101 void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked( |
| 1102 const gfx::Range& range, | 1102 const gfx::Range& range, |
| 1103 int event_flags) { | 1103 int event_flags) { |
| 1104 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); | 1104 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); |
| 1105 parent_->model()->OnBrandLinkClicked(); | 1105 parent_->model()->OnBrandLinkClicked(); |
| 1106 } | 1106 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { | 1246 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { |
| 1247 if (model()->local_credentials().empty()) { | 1247 if (model()->local_credentials().empty()) { |
| 1248 // Skip confirmation if there are no existing passwords for this site. | 1248 // Skip confirmation if there are no existing passwords for this site. |
| 1249 NotifyConfirmedNeverForThisSite(); | 1249 NotifyConfirmedNeverForThisSite(); |
| 1250 } else { | 1250 } else { |
| 1251 model()->OnConfirmationForNeverForThisSite(); | 1251 model()->OnConfirmationForNeverForThisSite(); |
| 1252 Refresh(); | 1252 Refresh(); |
| 1253 SizeToContents(); | 1253 SizeToContents(); |
| 1254 } | 1254 } |
| 1255 } | 1255 } |
| OLD | NEW |