OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl_client_certificate_selector.h" | 5 #include "chrome/browser/ui/views/ssl_client_certificate_selector.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/certificate_viewer.h" | 11 #include "chrome/browser/certificate_viewer.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 107 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
108 SetLayoutManager(layout); | 108 SetLayoutManager(layout); |
109 | 109 |
110 const int column_set_id = 0; | 110 const int column_set_id = 0; |
111 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); | 111 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); |
112 column_set->AddColumn( | 112 column_set->AddColumn( |
113 views::GridLayout::FILL, views::GridLayout::FILL, | 113 views::GridLayout::FILL, views::GridLayout::FILL, |
114 1, views::GridLayout::USE_PREF, 0, 0); | 114 1, views::GridLayout::USE_PREF, 0, 0); |
115 | 115 |
116 layout->StartRow(0, column_set_id); | 116 layout->StartRow(0, column_set_id); |
117 std::wstring text = UTF16ToWide(l10n_util::GetStringFUTF16( | 117 string16 text = l10n_util::GetStringFUTF16( |
118 IDS_CLIENT_CERT_DIALOG_TEXT, | 118 IDS_CLIENT_CERT_DIALOG_TEXT, |
119 ASCIIToUTF16(cert_request_info_->host_and_port))); | 119 ASCIIToUTF16(cert_request_info_->host_and_port)); |
120 views::Label* label = new views::Label(text); | 120 views::Label* label = new views::Label(text); |
121 label->SetMultiLine(true); | 121 label->SetMultiLine(true); |
122 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 122 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
123 label->SetAllowCharacterBreak(true); | 123 label->SetAllowCharacterBreak(true); |
124 layout->AddView(label); | 124 layout->AddView(label); |
125 | 125 |
126 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 126 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
127 | 127 |
128 CreateCertTable(); | 128 CreateCertTable(); |
129 layout->StartRow(1, column_set_id); | 129 layout->StartRow(1, column_set_id); |
130 layout->AddView(table_); | 130 layout->AddView(table_->CreateParentIfNecessary(), 1, 1, |
| 131 views::GridLayout::FILL, |
| 132 views::GridLayout::FILL, kTableViewWidth, kTableViewHeight); |
131 | 133 |
132 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 134 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
133 | 135 |
134 CreateViewCertButton(); | 136 CreateViewCertButton(); |
135 | 137 |
136 StartObserving(); | 138 StartObserving(); |
137 | 139 |
138 window_ = new ConstrainedWindowViews(wrapper_, this); | 140 window_ = new ConstrainedWindowViews(wrapper_, this); |
139 | 141 |
140 // Select the first row automatically. This must be done after the dialog has | 142 // Select the first row automatically. This must be done after the dialog has |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 253 |
252 void SSLClientCertificateSelector::CreateCertTable() { | 254 void SSLClientCertificateSelector::CreateCertTable() { |
253 std::vector<ui::TableColumn> columns; | 255 std::vector<ui::TableColumn> columns; |
254 columns.push_back(ui::TableColumn()); | 256 columns.push_back(ui::TableColumn()); |
255 table_ = new views::TableView(model_.get(), | 257 table_ = new views::TableView(model_.get(), |
256 columns, | 258 columns, |
257 views::TEXT_ONLY, | 259 views::TEXT_ONLY, |
258 true, // single_selection | 260 true, // single_selection |
259 true, // resizable_columns | 261 true, // resizable_columns |
260 true); // autosize_columns | 262 true); // autosize_columns |
261 table_->SetPreferredSize(gfx::Size(kTableViewWidth, kTableViewHeight)); | |
262 table_->SetObserver(this); | 263 table_->SetObserver(this); |
263 } | 264 } |
264 | 265 |
265 void SSLClientCertificateSelector::CreateViewCertButton() { | 266 void SSLClientCertificateSelector::CreateViewCertButton() { |
266 view_cert_button_ = new views::NativeTextButton(this, UTF16ToWide( | 267 view_cert_button_ = new views::NativeTextButton(this, |
267 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); | 268 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON)); |
268 | 269 |
269 // Wrap the view cert button in a grid layout in order to left-align it. | 270 // Wrap the view cert button in a grid layout in order to left-align it. |
270 view_cert_button_container_ = new views::View(); | 271 view_cert_button_container_ = new views::View(); |
271 views::GridLayout* layout = new views::GridLayout( | 272 views::GridLayout* layout = new views::GridLayout( |
272 view_cert_button_container_); | 273 view_cert_button_container_); |
273 view_cert_button_container_->SetLayoutManager(layout); | 274 view_cert_button_container_->SetLayoutManager(layout); |
274 | 275 |
275 int column_set_id = 0; | 276 int column_set_id = 0; |
276 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); | 277 views::ColumnSet* column_set = layout->AddColumnSet(column_set_id); |
277 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, | 278 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, |
(...skipping 12 matching lines...) Expand all Loading... |
290 net::SSLCertRequestInfo* cert_request_info, | 291 net::SSLCertRequestInfo* cert_request_info, |
291 SSLClientAuthHandler* delegate) { | 292 SSLClientAuthHandler* delegate) { |
292 DVLOG(1) << __FUNCTION__ << " " << wrapper; | 293 DVLOG(1) << __FUNCTION__ << " " << wrapper; |
293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 294 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
294 (new SSLClientCertificateSelector(wrapper, | 295 (new SSLClientCertificateSelector(wrapper, |
295 cert_request_info, | 296 cert_request_info, |
296 delegate))->Init(); | 297 delegate))->Init(); |
297 } | 298 } |
298 | 299 |
299 } // namespace browser | 300 } // namespace browser |
OLD | NEW |