| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 420 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
| 421 SetLayoutManager(layout); | 421 SetLayoutManager(layout); |
| 422 | 422 |
| 423 // Add the title. | 423 // Add the title. |
| 424 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 424 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
| 425 AddTitleRow(layout, parent_->model()); | 425 AddTitleRow(layout, parent_->model()); |
| 426 | 426 |
| 427 // If we have a list of passwords to store for the current site, display | 427 // If we have a list of passwords to store for the current site, display |
| 428 // them to the user for management. Otherwise, render a "No passwords for | 428 // them to the user for management. Otherwise, render a "No passwords for |
| 429 // this site" message. | 429 // this site" message. |
| 430 if (!parent_->model()->local_credentials().empty()) { | 430 |
| 431 bool only_PSL_matches = |
| 432 find_if(parent_->model()->local_credentials().begin(), |
| 433 parent_->model()->local_credentials().end(), |
| 434 [](const autofill::PasswordForm* form) { |
| 435 return !form->is_public_suffix_match; |
| 436 }) == parent_->model()->local_credentials().end(); |
| 437 |
| 438 if (!only_PSL_matches) { |
| 431 ManagePasswordItemsView* item = new ManagePasswordItemsView( | 439 ManagePasswordItemsView* item = new ManagePasswordItemsView( |
| 432 parent_->model(), parent_->model()->local_credentials().get()); | 440 parent_->model(), parent_->model()->local_credentials().get()); |
| 433 layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, | 441 layout->StartRowWithPadding(0, SINGLE_VIEW_COLUMN_SET, 0, |
| 434 views::kUnrelatedControlVerticalSpacing); | 442 views::kUnrelatedControlVerticalSpacing); |
| 435 layout->AddView(item); | 443 layout->AddView(item); |
| 436 } else { | 444 } else { |
| 437 views::Label* empty_label = new views::Label( | 445 views::Label* empty_label = new views::Label( |
| 438 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); | 446 l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS)); |
| 439 empty_label->SetMultiLine(true); | 447 empty_label->SetMultiLine(true); |
| 440 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 448 empty_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 AddChildView(new UpdatePendingView(this)); | 835 AddChildView(new UpdatePendingView(this)); |
| 828 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { | 836 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { |
| 829 AddChildView(new SaveConfirmationView(this)); | 837 AddChildView(new SaveConfirmationView(this)); |
| 830 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 838 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 831 AddChildView(new AutoSigninView(this)); | 839 AddChildView(new AutoSigninView(this)); |
| 832 } else { | 840 } else { |
| 833 AddChildView(new ManageView(this)); | 841 AddChildView(new ManageView(this)); |
| 834 } | 842 } |
| 835 GetLayoutManager()->Layout(this); | 843 GetLayoutManager()->Layout(this); |
| 836 } | 844 } |
| OLD | NEW |