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

Side by Side Diff: chrome/browser/ui/views/certificate_selector.cc

Issue 927293002: platformKeys: Hook up the certificate selection dialog to selectClientCertificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_perms
Patch Set: 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 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/certificate_selector.h" 5 #include "chrome/browser/ui/views/certificate_selector.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/certificate_viewer.h" 9 #include "chrome/browser/certificate_viewer.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 CertificateSelector::~CertificateSelector() { 80 CertificateSelector::~CertificateSelector() {
81 table_->SetModel(nullptr); 81 table_->SetModel(nullptr);
82 } 82 }
83 83
84 void CertificateSelector::Init(const base::string16& text) { 84 void CertificateSelector::Init(const base::string16& text) {
85 views::GridLayout* const layout = views::GridLayout::CreatePanel(this); 85 views::GridLayout* const layout = views::GridLayout::CreatePanel(this);
86 SetLayoutManager(layout); 86 SetLayoutManager(layout);
87 87
88 // The dimensions of the certificate selector table view, in pixels.
89 static const int kTableViewWidth = 400;
90 static const int kTableViewHeight = 100;
91
88 const int column_set_id = 0; 92 const int column_set_id = 0;
89 views::ColumnSet* const column_set = layout->AddColumnSet(column_set_id); 93 views::ColumnSet* const column_set = layout->AddColumnSet(column_set_id);
90 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 94 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
91 views::GridLayout::USE_PREF, 0, 0); 95 views::GridLayout::USE_PREF, 0, 0);
92 96
93 layout->StartRow(0, column_set_id); 97 layout->StartRow(0, column_set_id);
94 views::Label* const label = new views::Label(text); 98 views::Label* const label = new views::Label(text);
95 label->SetMultiLine(true); 99 label->SetMultiLine(true);
96 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 100 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
97 label->SetAllowCharacterBreak(true); 101 label->SetAllowCharacterBreak(true);
102 label->SizeToFit(kTableViewWidth);
98 layout->AddView(label); 103 layout->AddView(label);
99 104
100 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 105 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
101 106
102 // The dimensions of the certificate selector table view, in pixels.
103 static const int kTableViewWidth = 400;
104 static const int kTableViewHeight = 100;
105
106 table_ = CreateCertTable(); 107 table_ = CreateCertTable();
107 layout->StartRow(1, column_set_id); 108 layout->StartRow(1, column_set_id);
108 layout->AddView(table_->CreateParentIfNecessary(), 1, 1, 109 layout->AddView(table_->CreateParentIfNecessary(), 1, 1,
109 views::GridLayout::FILL, views::GridLayout::FILL, 110 views::GridLayout::FILL, views::GridLayout::FILL,
110 kTableViewWidth, kTableViewHeight); 111 kTableViewWidth, kTableViewHeight);
111 112
112 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 113 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
113 114
114 constrained_window::ShowWebModalDialogViews(this, web_contents_); 115 constrained_window::ShowWebModalDialogViews(this, web_contents_);
115 116
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 views::TableView* CertificateSelector::CreateCertTable() { 184 views::TableView* CertificateSelector::CreateCertTable() {
184 std::vector<ui::TableColumn> columns; 185 std::vector<ui::TableColumn> columns;
185 columns.push_back(ui::TableColumn()); 186 columns.push_back(ui::TableColumn());
186 views::TableView* const table = new views::TableView( 187 views::TableView* const table = new views::TableView(
187 model_.get(), columns, views::TEXT_ONLY, true /* single_selection */); 188 model_.get(), columns, views::TEXT_ONLY, true /* single_selection */);
188 table->SetObserver(this); 189 table->SetObserver(this);
189 return table; 190 return table;
190 } 191 }
191 192
192 } // namespace chrome 193 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698