| 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 "base/i18n/time_formatting.h" | 5 #include "base/i18n/time_formatting.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "chrome/browser/ui/webui/certificate_viewer.h" | 8 #include "chrome/browser/certificate_viewer.h" |
| 9 #include "chrome/common/url_constants.h" | |
| 10 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/ui/gtk/certificate_dialogs.h" | 12 #include "chrome/browser/ui/gtk/certificate_dialogs.h" |
| 13 #include "chrome/browser/ui/browser_dialogs.h" | 13 #include "chrome/browser/ui/webui/certificate_viewer.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 14 #include "chrome/common/net/x509_certificate_model.h" | 15 #include "chrome/common/net/x509_certificate_model.h" |
| 16 #include "chrome/common/url_constants.h" |
| 15 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| 20 | 22 |
| 21 // Default width/height of the dialog. | 23 // Default width/height of the dialog. |
| 22 const int kDefaultWidth = 450; | 24 const int kDefaultWidth = 450; |
| 23 const int kDefaultHeight = 450; | 25 const int kDefaultHeight = 450; |
| 24 | 26 |
| 25 } // namespace | 27 } // namespace |
| 26 | 28 |
| 27 // Shows a certificate using the WebUI certificate viewer. | 29 // Shows a certificate using the native or WebUI certificate viewer. |
| 28 void ShowCertificateViewer(gfx::NativeWindow parent, | 30 void ShowCertificateViewer(gfx::NativeWindow parent, |
| 29 net::X509Certificate* cert) { | 31 net::X509Certificate* cert) { |
| 30 CertificateViewerDialog::ShowDialog(parent, cert); | 32 if (ChromeWebUI::IsMoreWebUI()) { |
| 33 CertificateViewerDialog::ShowDialog(parent, cert); |
| 34 } else { |
| 35 ShowNativeCertificateViewer(parent, cert); |
| 36 } |
| 31 } | 37 } |
| 32 | 38 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////////// |
| 34 // CertificateViewerDialog | 40 // CertificateViewerDialog |
| 35 | 41 |
| 36 void CertificateViewerDialog::ShowDialog(gfx::NativeWindow parent, | 42 void CertificateViewerDialog::ShowDialog(gfx::NativeWindow parent, |
| 37 net::X509Certificate* cert) { | 43 net::X509Certificate* cert) { |
| 38 Browser* browser = BrowserList::GetLastActive(); | 44 Browser* browser = BrowserList::GetLastActive(); |
| 39 DCHECK(browser); | 45 DCHECK(browser); |
| 40 browser->BrowserShowHtmlDialog(new CertificateViewerDialog(parent, cert), | 46 browser->BrowserShowHtmlDialog(new CertificateViewerDialog(parent, cert), |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 cert_sub_fields->Append(node_details = new DictionaryValue()); | 383 cert_sub_fields->Append(node_details = new DictionaryValue()); |
| 378 node_details->SetString("label", | 384 node_details->SetString("label", |
| 379 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); | 385 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); |
| 380 node_details->SetString("payload.val", | 386 node_details->SetString("payload.val", |
| 381 x509_certificate_model::HashCertSHA1(cert)); | 387 x509_certificate_model::HashCertSHA1(cert)); |
| 382 | 388 |
| 383 // Send certificate information to javascript. | 389 // Send certificate information to javascript. |
| 384 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields", | 390 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields", |
| 385 root_list); | 391 root_list); |
| 386 } | 392 } |
| OLD | NEW |