| OLD | NEW |
| 1 // Copyright (c) 2012 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 #include <pango/pango-font.h> | 6 #include <pango/pango-font.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 : certificate_(certificate) { | 141 : certificate_(certificate) { |
| 142 cert_chain_list_.insert(cert_chain_list_.begin(), | 142 cert_chain_list_.insert(cert_chain_list_.begin(), |
| 143 certificate_->os_cert_handle()); | 143 certificate_->os_cert_handle()); |
| 144 const net::X509Certificate::OSCertHandles& certs = | 144 const net::X509Certificate::OSCertHandles& certs = |
| 145 certificate_->GetIntermediateCertificates(); | 145 certificate_->GetIntermediateCertificates(); |
| 146 cert_chain_list_.insert(cert_chain_list_.end(), certs.begin(), certs.end()); | 146 cert_chain_list_.insert(cert_chain_list_.end(), certs.begin(), certs.end()); |
| 147 | 147 |
| 148 dialog_ = gtk_dialog_new_with_buttons( | 148 dialog_ = gtk_dialog_new_with_buttons( |
| 149 l10n_util::GetStringFUTF8( | 149 l10n_util::GetStringFUTF8( |
| 150 IDS_CERT_INFO_DIALOG_TITLE, | 150 IDS_CERT_INFO_DIALOG_TITLE, |
| 151 UTF8ToUTF16( | 151 base::UTF8ToUTF16( |
| 152 x509_certificate_model::GetTitle( | 152 x509_certificate_model::GetTitle( |
| 153 cert_chain_list_.front()))).c_str(), | 153 cert_chain_list_.front()))).c_str(), |
| 154 parent, | 154 parent, |
| 155 // Non-modal. | 155 // Non-modal. |
| 156 GTK_DIALOG_NO_SEPARATOR, | 156 GTK_DIALOG_NO_SEPARATOR, |
| 157 GTK_STOCK_CLOSE, | 157 GTK_STOCK_CLOSE, |
| 158 GTK_RESPONSE_CLOSE, | 158 GTK_RESPONSE_CLOSE, |
| 159 NULL); | 159 NULL); |
| 160 | 160 |
| 161 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); | 161 GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog_)); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 AddKeyValue(table, row++, | 263 AddKeyValue(table, row++, |
| 264 l10n_util::GetStringUTF8(IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL), | 264 l10n_util::GetStringUTF8(IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL), |
| 265 x509_certificate_model::GetIssuerOrgUnitName( | 265 x509_certificate_model::GetIssuerOrgUnitName( |
| 266 cert, alternative_text)); | 266 cert, alternative_text)); |
| 267 | 267 |
| 268 row += 2; // Add spacing (kControlSpacing * 3 == kContentAreaSpacing). | 268 row += 2; // Add spacing (kControlSpacing * 3 == kContentAreaSpacing). |
| 269 | 269 |
| 270 base::Time issued, expires; | 270 base::Time issued, expires; |
| 271 std::string issued_str, expires_str; | 271 std::string issued_str, expires_str; |
| 272 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 272 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
| 273 issued_str = UTF16ToUTF8( | 273 issued_str = base::UTF16ToUTF8( |
| 274 base::TimeFormatShortDateNumeric(issued)); | 274 base::TimeFormatShortDateNumeric(issued)); |
| 275 expires_str = UTF16ToUTF8( | 275 expires_str = base::UTF16ToUTF8( |
| 276 base::TimeFormatShortDateNumeric(expires)); | 276 base::TimeFormatShortDateNumeric(expires)); |
| 277 } else { | 277 } else { |
| 278 issued_str = alternative_text; | 278 issued_str = alternative_text; |
| 279 expires_str = alternative_text; | 279 expires_str = alternative_text; |
| 280 } | 280 } |
| 281 AddTitle(table, row++, | 281 AddTitle(table, row++, |
| 282 l10n_util::GetStringUTF8(IDS_CERT_INFO_VALIDITY_GROUP)); | 282 l10n_util::GetStringUTF8(IDS_CERT_INFO_VALIDITY_GROUP)); |
| 283 AddKeyValue(table, row++, | 283 AddKeyValue(table, row++, |
| 284 l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUED_ON_LABEL), | 284 l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUED_ON_LABEL), |
| 285 issued_str); | 285 issued_str); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 store, &cert_iter, | 346 store, &cert_iter, |
| 347 FIELDS_NAME, | 347 FIELDS_NAME, |
| 348 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE).c_str(), | 348 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_CERTIFICATE).c_str(), |
| 349 FIELDS_VALUE, "", | 349 FIELDS_VALUE, "", |
| 350 -1); | 350 -1); |
| 351 | 351 |
| 352 std::string version_str; | 352 std::string version_str; |
| 353 std::string version = x509_certificate_model::GetVersion(cert); | 353 std::string version = x509_certificate_model::GetVersion(cert); |
| 354 if (!version.empty()) | 354 if (!version.empty()) |
| 355 version_str = l10n_util::GetStringFUTF8(IDS_CERT_DETAILS_VERSION_FORMAT, | 355 version_str = l10n_util::GetStringFUTF8(IDS_CERT_DETAILS_VERSION_FORMAT, |
| 356 UTF8ToUTF16(version)); | 356 base::UTF8ToUTF16(version)); |
| 357 GtkTreeIter iter; | 357 GtkTreeIter iter; |
| 358 gtk_tree_store_append(store, &iter, &cert_iter); | 358 gtk_tree_store_append(store, &iter, &cert_iter); |
| 359 gtk_tree_store_set( | 359 gtk_tree_store_set( |
| 360 store, &iter, | 360 store, &iter, |
| 361 FIELDS_NAME, | 361 FIELDS_NAME, |
| 362 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VERSION).c_str(), | 362 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VERSION).c_str(), |
| 363 FIELDS_VALUE, version_str.c_str(), | 363 FIELDS_VALUE, version_str.c_str(), |
| 364 -1); | 364 -1); |
| 365 | 365 |
| 366 gtk_tree_store_append(store, &iter, &cert_iter); | 366 gtk_tree_store_append(store, &iter, &cert_iter); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 396 gtk_tree_store_set( | 396 gtk_tree_store_set( |
| 397 store, &validity_iter, | 397 store, &validity_iter, |
| 398 FIELDS_NAME, | 398 FIELDS_NAME, |
| 399 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY).c_str(), | 399 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_VALIDITY).c_str(), |
| 400 FIELDS_VALUE, "", | 400 FIELDS_VALUE, "", |
| 401 -1); | 401 -1); |
| 402 | 402 |
| 403 base::Time issued, expires; | 403 base::Time issued, expires; |
| 404 std::string issued_str, expires_str; | 404 std::string issued_str, expires_str; |
| 405 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 405 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
| 406 issued_str = UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued)); | 406 issued_str = base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(issued)); |
| 407 expires_str = UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires)); | 407 expires_str = base::UTF16ToUTF8(base::TimeFormatShortDateAndTime(expires)); |
| 408 } | 408 } |
| 409 gtk_tree_store_append(store, &iter, &validity_iter); | 409 gtk_tree_store_append(store, &iter, &validity_iter); |
| 410 gtk_tree_store_set( | 410 gtk_tree_store_set( |
| 411 store, &iter, | 411 store, &iter, |
| 412 FIELDS_NAME, | 412 FIELDS_NAME, |
| 413 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE).c_str(), | 413 l10n_util::GetStringUTF8(IDS_CERT_DETAILS_NOT_BEFORE).c_str(), |
| 414 FIELDS_VALUE, issued_str.c_str(), | 414 FIELDS_VALUE, issued_str.c_str(), |
| 415 -1); | 415 -1); |
| 416 gtk_tree_store_append(store, &iter, &validity_iter); | 416 gtk_tree_store_append(store, &iter, &validity_iter); |
| 417 gtk_tree_store_set( | 417 gtk_tree_store_set( |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 gtk_util::ShowDialog(dialog_); | 718 gtk_util::ShowDialog(dialog_); |
| 719 } | 719 } |
| 720 | 720 |
| 721 } // namespace | 721 } // namespace |
| 722 | 722 |
| 723 void ShowCertificateViewer(content::WebContents* web_contents, | 723 void ShowCertificateViewer(content::WebContents* web_contents, |
| 724 gfx::NativeWindow parent, | 724 gfx::NativeWindow parent, |
| 725 net::X509Certificate* cert) { | 725 net::X509Certificate* cert) { |
| 726 (new CertificateViewer(parent, cert))->Show(); | 726 (new CertificateViewer(parent, cert))->Show(); |
| 727 } | 727 } |
| OLD | NEW |