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

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 943933004: Credential Manager API: add a new "Manage accounts" bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 10 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 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
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 for (const autofill::PasswordForm* form :
725 parent_->model()->local_pending_credentials()) {
726 // Add the title to the layout with appropriate padding.
727 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
728 layout->AddView(new ManageCredentialItemView(parent_->model(), form));
729 }
730
731 // Extra padding for visual awesomeness.
732 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
733 }
734
700 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- 735 // ManagePasswordsBubbleView::BlacklistedView ---------------------------------
701 736
702 // A view offering the user the ability to re-enable the password manager for 737 // 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". 738 // a specific site after she's decided to "never save passwords".
704 class ManagePasswordsBubbleView::BlacklistedView 739 class ManagePasswordsBubbleView::BlacklistedView
705 : public views::View, 740 : public views::View,
706 public views::ButtonListener { 741 public views::ButtonListener {
707 public: 742 public:
708 explicit BlacklistedView(ManagePasswordsBubbleView* parent); 743 explicit BlacklistedView(ManagePasswordsBubbleView* parent);
709 ~BlacklistedView() override; 744 ~BlacklistedView() override;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1081
1047 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() { 1082 void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() {
1048 if (model()->best_matches().empty()) { 1083 if (model()->best_matches().empty()) {
1049 // Skip confirmation if there are no existing passwords for this site. 1084 // Skip confirmation if there are no existing passwords for this site.
1050 NotifyConfirmedNeverForThisSite(); 1085 NotifyConfirmedNeverForThisSite();
1051 } else { 1086 } else {
1052 model()->OnConfirmationForNeverForThisSite(); 1087 model()->OnConfirmationForNeverForThisSite();
1053 Refresh(); 1088 Refresh();
1054 } 1089 }
1055 } 1090 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698