| 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/webui/certificate_viewer_webui.h" | 5 #include "chrome/browser/ui/webui/certificate_viewer_webui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "chrome/browser/certificate_viewer.h" | 12 #include "chrome/browser/certificate_viewer.h" |
| 13 #include "chrome/browser/ui/dialog_style.h" | 13 #include "chrome/browser/ui/dialog_style.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/browser/ui/certificate_dialogs.h" | 17 #include "chrome/browser/ui/certificate_dialogs.h" |
| 18 #include "chrome/browser/ui/dialog_style.h" | 18 #include "chrome/browser/ui/dialog_style.h" |
| 19 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 19 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 20 #include "chrome/common/net/x509_certificate_model.h" | 20 #include "chrome/common/net/x509_certificate_model.h" |
| 21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 22 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 | 25 |
| 26 #if defined(USE_AURA) | 26 #if defined(USE_AURA) |
| 27 #include "chrome/browser/ui/constrained_window.h" | 27 #include "chrome/browser/ui/constrained_window.h" |
| 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 29 #include "chrome/browser/ui/webui/constrained_html_ui.h" | 29 #include "chrome/browser/ui/webui/constrained_html_ui.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 using content::WebContents; | 32 using content::WebContents; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void CertificateViewerDialogHandler::ExportCertificate( | 167 void CertificateViewerDialogHandler::ExportCertificate( |
| 168 const base::ListValue* args) { | 168 const base::ListValue* args) { |
| 169 int cert_index; | 169 int cert_index; |
| 170 double val; | 170 double val; |
| 171 if (!(args->GetDouble(0, &val))) | 171 if (!(args->GetDouble(0, &val))) |
| 172 return; | 172 return; |
| 173 cert_index = (int)val; | 173 cert_index = (int)val; |
| 174 if (cert_index < 0 || cert_index >= (int)cert_chain_.size()) | 174 if (cert_index < 0 || cert_index >= (int)cert_chain_.size()) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 ShowCertExportDialog(web_ui()->tab_contents(), | 177 ShowCertExportDialog(web_ui()->web_contents(), |
| 178 window_, | 178 window_, |
| 179 cert_chain_[cert_index]); | 179 cert_chain_[cert_index]); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void CertificateViewerDialogHandler::RequestCertificateInfo( | 182 void CertificateViewerDialogHandler::RequestCertificateInfo( |
| 183 const base::ListValue* args) { | 183 const base::ListValue* args) { |
| 184 // Certificate information. The keys in this dictionary's general key | 184 // Certificate information. The keys in this dictionary's general key |
| 185 // correspond to the IDs in the Html page. | 185 // correspond to the IDs in the Html page. |
| 186 DictionaryValue cert_info; | 186 DictionaryValue cert_info; |
| 187 net::X509Certificate::OSCertHandle cert_hnd = cert_->os_cert_handle(); | 187 net::X509Certificate::OSCertHandle cert_hnd = cert_->os_cert_handle(); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 cert_sub_fields->Append(node_details = new DictionaryValue()); | 418 cert_sub_fields->Append(node_details = new DictionaryValue()); |
| 419 node_details->SetString("label", | 419 node_details->SetString("label", |
| 420 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); | 420 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); |
| 421 node_details->SetString("payload.val", | 421 node_details->SetString("payload.val", |
| 422 x509_certificate_model::HashCertSHA1(cert)); | 422 x509_certificate_model::HashCertSHA1(cert)); |
| 423 | 423 |
| 424 // Send certificate information to javascript. | 424 // Send certificate information to javascript. |
| 425 web_ui()->CallJavascriptFunction("cert_viewer.getCertificateFields", | 425 web_ui()->CallJavascriptFunction("cert_viewer.getCertificateFields", |
| 426 root_list); | 426 root_list); |
| 427 } | 427 } |
| OLD | NEW |