| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 string16 CertificateSelectorTableModel::GetText(int index, int column_id) { | 70 string16 CertificateSelectorTableModel::GetText(int index, int column_id) { |
| 71 DCHECK_EQ(column_id, 0); | 71 DCHECK_EQ(column_id, 0); |
| 72 DCHECK_GE(index, 0); | 72 DCHECK_GE(index, 0); |
| 73 DCHECK_LT(index, static_cast<int>(items_.size())); | 73 DCHECK_LT(index, static_cast<int>(items_.size())); |
| 74 | 74 |
| 75 return items_[index]; | 75 return items_[index]; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void CertificateSelectorTableModel::SetObserver(TableModelObserver* observer) { | 78 void CertificateSelectorTableModel::SetObserver( |
| 79 ui::TableModelObserver* observer) { |
| 79 } | 80 } |
| 80 | 81 |
| 81 /////////////////////////////////////////////////////////////////////////////// | 82 /////////////////////////////////////////////////////////////////////////////// |
| 82 // SSLClientCertificateSelector: | 83 // SSLClientCertificateSelector: |
| 83 | 84 |
| 84 SSLClientCertificateSelector::SSLClientCertificateSelector( | 85 SSLClientCertificateSelector::SSLClientCertificateSelector( |
| 85 TabContents* parent, | 86 TabContents* parent, |
| 86 net::SSLCertRequestInfo* cert_request_info, | 87 net::SSLCertRequestInfo* cert_request_info, |
| 87 SSLClientAuthHandler* delegate) | 88 SSLClientAuthHandler* delegate) |
| 88 : SSLClientAuthObserver(cert_request_info, delegate), | 89 : SSLClientAuthObserver(cert_request_info, delegate), |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 237 |
| 237 void SSLClientCertificateSelector::OnDoubleClick() { | 238 void SSLClientCertificateSelector::OnDoubleClick() { |
| 238 if (Accept()) | 239 if (Accept()) |
| 239 window_->CloseConstrainedWindow(); | 240 window_->CloseConstrainedWindow(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 /////////////////////////////////////////////////////////////////////////////// | 243 /////////////////////////////////////////////////////////////////////////////// |
| 243 // SSLClientCertificateSelector private methods: | 244 // SSLClientCertificateSelector private methods: |
| 244 | 245 |
| 245 void SSLClientCertificateSelector::CreateCertTable() { | 246 void SSLClientCertificateSelector::CreateCertTable() { |
| 246 std::vector<TableColumn> columns; | 247 std::vector<ui::TableColumn> columns; |
| 247 columns.push_back(TableColumn()); | 248 columns.push_back(ui::TableColumn()); |
| 248 table_ = new views::TableView( | 249 table_ = new views::TableView(model_.get(), |
| 249 model_.get(), | 250 columns, |
| 250 columns, | 251 views::TEXT_ONLY, |
| 251 views::TEXT_ONLY, | 252 true, // single_selection |
| 252 true, // single_selection | 253 true, // resizable_columns |
| 253 true, // resizable_columns | 254 true); // autosize_columns |
| 254 true); // autosize_columns | 255 table_->SetPreferredSize(gfx::Size(kTableViewWidth, kTableViewHeight)); |
| 255 table_->SetPreferredSize( | |
| 256 gfx::Size(kTableViewWidth, kTableViewHeight)); | |
| 257 table_->SetObserver(this); | 256 table_->SetObserver(this); |
| 258 } | 257 } |
| 259 | 258 |
| 260 void SSLClientCertificateSelector::CreateViewCertButton() { | 259 void SSLClientCertificateSelector::CreateViewCertButton() { |
| 261 view_cert_button_ = new views::NativeTextButton(this, UTF16ToWide( | 260 view_cert_button_ = new views::NativeTextButton(this, UTF16ToWide( |
| 262 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); | 261 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); |
| 263 | 262 |
| 264 // Wrap the view cert button in a grid layout in order to left-align it. | 263 // Wrap the view cert button in a grid layout in order to left-align it. |
| 265 view_cert_button_container_ = new views::View(); | 264 view_cert_button_container_ = new views::View(); |
| 266 views::GridLayout* layout = new views::GridLayout( | 265 views::GridLayout* layout = new views::GridLayout( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 285 net::SSLCertRequestInfo* cert_request_info, | 284 net::SSLCertRequestInfo* cert_request_info, |
| 286 SSLClientAuthHandler* delegate) { | 285 SSLClientAuthHandler* delegate) { |
| 287 DVLOG(1) << __FUNCTION__ << " " << parent; | 286 DVLOG(1) << __FUNCTION__ << " " << parent; |
| 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 287 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 289 (new SSLClientCertificateSelector(parent, | 288 (new SSLClientCertificateSelector(parent, |
| 290 cert_request_info, | 289 cert_request_info, |
| 291 delegate))->Init(); | 290 delegate))->Init(); |
| 292 } | 291 } |
| 293 | 292 |
| 294 } // namespace browser | 293 } // namespace browser |
| OLD | NEW |