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