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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 SetLayoutManager(layout); | 829 SetLayoutManager(layout); |
830 | 830 |
831 // Create the pending credential item, update button. | 831 // Create the pending credential item, update button. |
832 View* item = nullptr; | 832 View* item = nullptr; |
833 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { | 833 if (parent->model()->ShouldShowMultipleAccountUpdateUI()) { |
834 selection_view_ = new CredentialsSelectionView( | 834 selection_view_ = new CredentialsSelectionView( |
835 parent->model(), parent->model()->local_credentials().get(), | 835 parent->model(), parent->model()->local_credentials().get(), |
836 parent->model()->pending_password().username_value); | 836 parent->model()->pending_password().username_value); |
837 item = selection_view_; | 837 item = selection_view_; |
838 } else { | 838 } else { |
839 DCHECK_EQ(1u, parent->model()->local_credentials().size()); | |
840 DCHECK_EQ(parent->model()->local_credentials()[0]->username_value, | |
841 parent->model()->pending_password().username_value); | |
842 std::vector<const autofill::PasswordForm*> forms; | 839 std::vector<const autofill::PasswordForm*> forms; |
843 forms.push_back(&parent->model()->pending_password()); | 840 forms.push_back(&parent->model()->pending_password()); |
844 item = new ManagePasswordItemsView(parent_->model(), forms); | 841 item = new ManagePasswordItemsView(parent_->model(), forms); |
845 } | 842 } |
846 nope_button_ = new views::LabelButton( | 843 nope_button_ = new views::LabelButton( |
847 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); | 844 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); |
848 nope_button_->SetStyle(views::Button::STYLE_BUTTON); | 845 nope_button_->SetStyle(views::Button::STYLE_BUTTON); |
849 nope_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( | 846 nope_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( |
850 ui::ResourceBundle::SmallFont)); | 847 ui::ResourceBundle::SmallFont)); |
851 | 848 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( | 890 void ManagePasswordsBubbleView::UpdatePendingView::ButtonPressed( |
894 views::Button* sender, | 891 views::Button* sender, |
895 const ui::Event& event) { | 892 const ui::Event& event) { |
896 DCHECK(sender == update_button_ || sender == nope_button_); | 893 DCHECK(sender == update_button_ || sender == nope_button_); |
897 if (sender == update_button_) { | 894 if (sender == update_button_) { |
898 if (selection_view_) { | 895 if (selection_view_) { |
899 // Multi account case. | 896 // Multi account case. |
900 parent_->model()->OnUpdateClicked( | 897 parent_->model()->OnUpdateClicked( |
901 *selection_view_->GetSelectedCredentials()); | 898 *selection_view_->GetSelectedCredentials()); |
902 } else { | 899 } else { |
903 parent_->model()->OnUpdateClicked( | 900 parent_->model()->OnUpdateClicked(parent_->model()->pending_password()); |
904 *parent_->model()->local_credentials()[0]); | |
905 } | 901 } |
| 902 } else { |
| 903 parent_->model()->OnNopeUpdateClicked(); |
906 } | 904 } |
907 parent_->Close(); | 905 parent_->Close(); |
908 } | 906 } |
909 | 907 |
910 void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked( | 908 void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked( |
911 const gfx::Range& range, | 909 const gfx::Range& range, |
912 int event_flags) { | 910 int event_flags) { |
913 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); | 911 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); |
914 parent_->model()->OnBrandLinkClicked(); | 912 parent_->model()->OnBrandLinkClicked(); |
915 } | 913 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } else if (model()->state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 1026 } else if (model()->state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
1029 AddChildView(new AutoSigninView(this)); | 1027 AddChildView(new AutoSigninView(this)); |
1030 } else { | 1028 } else { |
1031 if (model()->IsNewUIActive()) | 1029 if (model()->IsNewUIActive()) |
1032 AddChildView(new ManageAccountsView(this)); | 1030 AddChildView(new ManageAccountsView(this)); |
1033 else | 1031 else |
1034 AddChildView(new ManageView(this)); | 1032 AddChildView(new ManageView(this)); |
1035 } | 1033 } |
1036 GetLayoutManager()->Layout(this); | 1034 GetLayoutManager()->Layout(this); |
1037 } | 1035 } |
OLD | NEW |