Chromium Code Reviews| 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" |
| 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 11 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 12 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
| 13 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 13 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 14 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" | 14 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 16 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 16 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
| 17 #include "chrome/browser/ui/views/passwords/manage_credential_item_view.h" | |
| 17 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" | 18 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
| 18 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" | 19 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" |
| 19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/views/controls/button/blue_button.h" | 24 #include "ui/views/controls/button/blue_button.h" |
| 24 #include "ui/views/controls/button/label_button.h" | 25 #include "ui/views/controls/button/label_button.h" |
| 25 #include "ui/views/controls/combobox/combobox.h" | 26 #include "ui/views/controls/combobox/combobox.h" |
| 26 #include "ui/views/controls/combobox/combobox_listener.h" | 27 #include "ui/views/controls/combobox/combobox_listener.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 parent_->Close(); | 691 parent_->Close(); |
| 691 } | 692 } |
| 692 | 693 |
| 693 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source, | 694 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source, |
| 694 int event_flags) { | 695 int event_flags) { |
| 695 DCHECK_EQ(source, manage_link_); | 696 DCHECK_EQ(source, manage_link_); |
| 696 parent_->model()->OnManageLinkClicked(); | 697 parent_->model()->OnManageLinkClicked(); |
| 697 parent_->Close(); | 698 parent_->Close(); |
| 698 } | 699 } |
| 699 | 700 |
| 701 // ManagePasswordsBubbleView::ManageAccountsView ------------------------------ | |
| 702 | |
| 703 // A view offering the user a list of his currently saved through the Credential | |
| 704 // Manager API accounts for the current page. | |
| 705 class ManagePasswordsBubbleView::ManageAccountsView : public views::View { | |
| 706 public: | |
| 707 explicit ManageAccountsView(ManagePasswordsBubbleView* parent); | |
| 708 | |
| 709 private: | |
| 710 ManagePasswordsBubbleView* parent_; | |
| 711 }; | |
| 712 | |
| 713 ManagePasswordsBubbleView::ManageAccountsView::ManageAccountsView( | |
| 714 ManagePasswordsBubbleView* parent) | |
| 715 : parent_(parent) { | |
| 716 views::GridLayout* layout = new views::GridLayout(this); | |
| 717 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | |
| 718 SetLayoutManager(layout); | |
| 719 | |
| 720 // Add the title. | |
| 721 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | |
| 722 AddTitleRow(layout, parent_->model()); | |
| 723 | |
| 724 net::URLRequestContextGetter* request_context = | |
| 725 parent_->model()->GetProfile()->GetRequestContext(); | |
| 726 for (auto* form : parent_->model()->local_pending_credentials()) { | |
|
Mike West
2015/02/20 16:21:39
Nit: This is just `autofill::PasswordForm*`, right
vasilii
2015/02/20 16:58:51
Done.
| |
| 727 // Add the title to the layout with appropriate padding. | |
| 728 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | |
| 729 layout->AddView( | |
| 730 new ManageCredentialItemView(parent_->model(), form, request_context)); | |
| 731 } | |
| 732 | |
| 733 // Extra padding for visual awesomeness. | |
| 734 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | |
| 735 } | |
| 736 | |
| 700 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- | 737 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- |
| 701 | 738 |
| 702 // A view offering the user the ability to re-enable the password manager for | 739 // A view offering the user the ability to re-enable the password manager for |
| 703 // a specific site after she's decided to "never save passwords". | 740 // a specific site after she's decided to "never save passwords". |
| 704 class ManagePasswordsBubbleView::BlacklistedView | 741 class ManagePasswordsBubbleView::BlacklistedView |
| 705 : public views::View, | 742 : public views::View, |
| 706 public views::ButtonListener { | 743 public views::ButtonListener { |
| 707 public: | 744 public: |
| 708 explicit BlacklistedView(ManagePasswordsBubbleView* parent); | 745 explicit BlacklistedView(ManagePasswordsBubbleView* parent); |
| 709 ~BlacklistedView() override; | 746 ~BlacklistedView() override; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1046 | 1083 |
| 1047 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { | 1084 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { |
| 1048 if (model()->best_matches().empty()) { | 1085 if (model()->best_matches().empty()) { |
| 1049 // Skip confirmation if there are no existing passwords for this site. | 1086 // Skip confirmation if there are no existing passwords for this site. |
| 1050 NotifyConfirmedNeverForThisSite(); | 1087 NotifyConfirmedNeverForThisSite(); |
| 1051 } else { | 1088 } else { |
| 1052 model()->OnConfirmationForNeverForThisSite(); | 1089 model()->OnConfirmationForNeverForThisSite(); |
| 1053 Refresh(); | 1090 Refresh(); |
| 1054 } | 1091 } |
| 1055 } | 1092 } |
| OLD | NEW |