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

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

Issue 2869683003: Views/Harmony: Remove references to layout constants in c/b/u/v/passwords. (Closed)
Patch Set: Created 3 years, 7 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/credentials_selection_view.h" 5 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
10 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
10 #include "components/password_manager/core/browser/password_manager_metrics_util .h" 11 #include "components/password_manager/core/browser/password_manager_metrics_util .h"
11 #include "ui/base/models/simple_combobox_model.h" 12 #include "ui/base/models/simple_combobox_model.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/combobox/combobox.h" 15 #include "ui/views/controls/combobox/combobox.h"
15 #include "ui/views/controls/label.h" 16 #include "ui/views/controls/label.h"
16 #include "ui/views/layout/grid_layout.h" 17 #include "ui/views/layout/grid_layout.h"
17 #include "ui/views/layout/layout_constants.h"
18 18
19 namespace { 19 namespace {
20 20
21 views::Label* GeneratePasswordLabel(const autofill::PasswordForm& form) { 21 views::Label* GeneratePasswordLabel(const autofill::PasswordForm& form) {
22 views::Label* label = new views::Label(form.password_value); 22 views::Label* label = new views::Label(form.password_value);
tapted 2017/05/10 05:30:11 CONTEXT_DEPRECATED_SMALL to the constructor
Patti Lor 2017/05/11 06:59:18 Done.
23 label->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList( 23 label->SetFontList(views::style::GetFont(views::style::CONTEXT_LABEL,
24 ui::ResourceBundle::SmallFont)); 24 views::style::STYLE_PRIMARY));
25 label->SetHorizontalAlignment(gfx::ALIGN_CENTER); 25 label->SetHorizontalAlignment(gfx::ALIGN_CENTER);
26 label->SetObscured(true); 26 label->SetObscured(true);
27 return label; 27 return label;
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 CredentialsSelectionView::CredentialsSelectionView( 32 CredentialsSelectionView::CredentialsSelectionView(
33 ManagePasswordsBubbleModel* manage_passwords_bubble_model) 33 ManagePasswordsBubbleModel* manage_passwords_bubble_model)
34 : password_forms_(&manage_passwords_bubble_model->local_credentials()), 34 : password_forms_(&manage_passwords_bubble_model->local_credentials()),
35 default_index_(0), 35 default_index_(0),
36 is_default_best_match_(false), 36 is_default_best_match_(false),
37 is_default_preferred_(false), 37 is_default_preferred_(false),
38 action_reported_(false) { 38 action_reported_(false) {
39 DCHECK(!password_forms_->empty()); 39 DCHECK(!password_forms_->empty());
40 40
41 // Layout. 41 // Layout.
42 views::GridLayout* layout = new views::GridLayout(this); 42 views::GridLayout* layout = new views::GridLayout(this);
43 SetLayoutManager(layout); 43 SetLayoutManager(layout);
44 44
45 // ColumnSet. 45 // ColumnSet.
46 int column_set_id = 0; 46 int column_set_id = 0;
47 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); 47 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id);
48 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 48 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
49 views::GridLayout::FIXED, 0, 0); 49 views::GridLayout::FIXED, 0, 0);
50 column_set->AddPaddingColumn(0, views::kItemLabelSpacing); 50 ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
51 const int inner_padding =
52 layout_provider->GetDistanceMetric(DISTANCE_RELATED_LABEL_HORIZONTAL);
53 column_set->AddPaddingColumn(0, inner_padding);
51 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 54 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
52 views::GridLayout::FIXED, 0, 0); 55 views::GridLayout::FIXED, 0, 0);
53 column_set->AddPaddingColumn(0, views::kItemLabelSpacing); 56 column_set->AddPaddingColumn(0, inner_padding);
54 57
55 // The username combobox and password label. 58 // The username combobox and password label.
56 layout->StartRowWithPadding(0, column_set_id, 0, 59 layout->StartRowWithPadding(0, column_set_id, 0,
57 views::kRelatedControlVerticalSpacing); 60 layout_provider->GetDistanceMetric(
61 views::DISTANCE_RELATED_CONTROL_VERTICAL));
Patti Lor 2017/05/11 06:59:18 Deleted this, because I realised that this is alwa
58 GenerateUsernameCombobox( 62 GenerateUsernameCombobox(
59 manage_passwords_bubble_model->pending_password().username_value); 63 manage_passwords_bubble_model->pending_password().username_value);
60 layout->AddView(combobox_.get()); 64 layout->AddView(combobox_.get());
61 views::Label* label = 65 views::Label* label =
62 GeneratePasswordLabel(manage_passwords_bubble_model->pending_password()); 66 GeneratePasswordLabel(manage_passwords_bubble_model->pending_password());
63 layout->AddView(label); 67 layout->AddView(label);
64 68
65 GetLayoutManager()->Layout(this); 69 GetLayoutManager()->Layout(this);
66 } 70 }
67 71
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 DEFAULT_ACCOUNT_PREFERRED_USER_CHANGED; 150 DEFAULT_ACCOUNT_PREFERRED_USER_CHANGED;
147 } else { 151 } else {
148 action = 152 action =
149 password_manager::metrics_util::DEFAULT_ACCOUNT_FIRST_USER_CHANGED; 153 password_manager::metrics_util::DEFAULT_ACCOUNT_FIRST_USER_CHANGED;
150 } 154 }
151 } 155 }
152 156
153 password_manager::metrics_util::LogMultiAccountUpdateBubbleUserAction(action); 157 password_manager::metrics_util::LogMultiAccountUpdateBubbleUserAction(action);
154 action_reported_ = true; 158 action_reported_ = true;
155 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698