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

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

Issue 952023002: Credential Manager API: pop up the new "Manage accounts" bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix the test Created 5 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_credential_item_view.h" 5 #include "chrome/browser/ui/views/passwords/manage_credential_item_view.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 8 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
9 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" 9 #include "chrome/browser/ui/views/passwords/credentials_item_view.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "components/autofill/core/common/password_form.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/resources/grit/ui_resources.h" 14 #include "ui/resources/grit/ui_resources.h"
14 #include "ui/views/controls/button/image_button.h" 15 #include "ui/views/controls/button/image_button.h"
15 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
16 #include "ui/views/controls/link.h" 17 #include "ui/views/controls/link.h"
17 #include "ui/views/layout/grid_layout.h" 18 #include "ui/views/layout/grid_layout.h"
18 #include "ui/views/layout/layout_constants.h" 19 #include "ui/views/layout/layout_constants.h"
19 20
20 namespace { 21 namespace {
(...skipping 21 matching lines...) Expand all
42 views::GridLayout::USE_PREF, 43 views::GridLayout::USE_PREF,
43 0, 44 0,
44 0); 45 0);
45 } 46 }
46 47
47 } // namespace 48 } // namespace
48 49
49 ManageCredentialItemView::ManageCredentialItemView( 50 ManageCredentialItemView::ManageCredentialItemView(
50 ManagePasswordsBubbleModel* model, 51 ManagePasswordsBubbleModel* model,
51 const autofill::PasswordForm* password_form) 52 const autofill::PasswordForm* password_form)
52 : form_(*password_form), 53 : form_(password_form),
53 delete_button_(nullptr), 54 delete_button_(nullptr),
54 undo_link_(nullptr), 55 undo_link_(nullptr),
55 model_(model), 56 model_(model),
56 form_deleted_(false) { 57 form_deleted_(false) {
57 net::URLRequestContextGetter* request_context = 58 net::URLRequestContextGetter* request_context =
58 model_->GetProfile()->GetRequestContext(); 59 model_->GetProfile()->GetRequestContext();
59 credential_button_.reset(new CredentialsItemView( 60 credential_button_.reset(new CredentialsItemView(
60 this, &form_, password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL, 61 this, form_, password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL,
61 CredentialsItemView::ACCOUNT_CHOOSER, request_context)); 62 CredentialsItemView::ACCOUNT_CHOOSER, request_context));
62 credential_button_->set_owned_by_client(); 63 credential_button_->set_owned_by_client();
63 credential_button_->SetEnabled(false); 64 credential_button_->SetEnabled(false);
64 Refresh(); 65 Refresh();
65 } 66 }
66 67
67 ManageCredentialItemView::~ManageCredentialItemView() { 68 ManageCredentialItemView::~ManageCredentialItemView() {
68 } 69 }
69 70
70 void ManageCredentialItemView::Refresh() { 71 void ManageCredentialItemView::Refresh() {
(...skipping 30 matching lines...) Expand all
101 layout->AddView(delete_button_); 102 layout->AddView(delete_button_);
102 } 103 }
103 104
104 GetLayoutManager()->Layout(this); 105 GetLayoutManager()->Layout(this);
105 } 106 }
106 107
107 void ManageCredentialItemView::ButtonPressed(views::Button* sender, 108 void ManageCredentialItemView::ButtonPressed(views::Button* sender,
108 const ui::Event& event) { 109 const ui::Event& event) {
109 DCHECK_EQ(delete_button_, sender); 110 DCHECK_EQ(delete_button_, sender);
110 form_deleted_ = true; 111 form_deleted_ = true;
111 // TODO(vasilii): notify |model_| about the deletion. 112 model_->OnPasswordAction(*form_, ManagePasswordsBubbleModel::REMOVE_PASSWORD);
112 Refresh(); 113 Refresh();
113 } 114 }
114 115
115 void ManageCredentialItemView::LinkClicked(views::Link* source, 116 void ManageCredentialItemView::LinkClicked(views::Link* source,
116 int event_flags) { 117 int event_flags) {
117 DCHECK_EQ(undo_link_, source); 118 DCHECK_EQ(undo_link_, source);
118 form_deleted_ = false; 119 form_deleted_ = false;
119 // TODO(vasilii): notify |model_| about adding. 120 model_->OnPasswordAction(*form_, ManagePasswordsBubbleModel::ADD_PASSWORD);
120 Refresh(); 121 Refresh();
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698