| 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/webui/chrome_web_ui.h" | 19 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
| 19 #include "chrome/common/net/x509_certificate_model.h" | 20 #include "chrome/common/net/x509_certificate_model.h" |
| 20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 21 #include "content/browser/tab_contents/tab_contents.h" | 22 #include "content/browser/tab_contents/tab_contents.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 | 25 |
| 25 #if defined(USE_AURA) | 26 #if defined(USE_AURA) |
| 26 #include "chrome/browser/ui/constrained_window.h" | 27 #include "chrome/browser/ui/constrained_window.h" |
| 27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 CertificateViewerDialog::~CertificateViewerDialog() { | 77 CertificateViewerDialog::~CertificateViewerDialog() { |
| 77 } | 78 } |
| 78 | 79 |
| 79 void CertificateViewerDialog::Show(gfx::NativeWindow parent) { | 80 void CertificateViewerDialog::Show(gfx::NativeWindow parent) { |
| 80 // TODO(oshima): Should get browser from parent. | 81 // TODO(oshima): Should get browser from parent. |
| 81 Browser* browser = BrowserList::GetLastActive(); | 82 Browser* browser = BrowserList::GetLastActive(); |
| 82 DCHECK(browser); | 83 DCHECK(browser); |
| 83 #if defined(USE_AURA) | 84 #if defined(USE_AURA) |
| 84 TabContentsWrapper* current_wrapper = | 85 TabContentsWrapper* current_wrapper = |
| 85 browser->GetSelectedTabContentsWrapper(); | 86 browser->GetSelectedTabContentsWrapper(); |
| 87 // TODO(bshe): UI tweaks needed for AURA html Dialog, such as add padding on |
| 88 // title for AURA ConstrainedHtmlDialog. |
| 86 window_ = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( | 89 window_ = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( |
| 87 current_wrapper->profile(), | 90 current_wrapper->profile(), |
| 88 this, | 91 this, |
| 89 current_wrapper)->window()->GetNativeWindow(); | 92 current_wrapper)->window()->GetNativeWindow(); |
| 93 #elif defined(OS_CHROMEOS) |
| 94 window_ = browser->BrowserShowHtmlDialog(this, parent, |
| 95 static_cast<DialogStyle>(STYLE_XBAR | STYLE_FLUSH_CONTENT)); |
| 90 #else | 96 #else |
| 91 window_ = browser->BrowserShowHtmlDialog(this, parent, STYLE_GENERIC); | 97 window_ = browser->BrowserShowHtmlDialog(this, parent, STYLE_GENERIC); |
| 92 #endif | 98 #endif |
| 93 } | 99 } |
| 94 | 100 |
| 95 bool CertificateViewerDialog::IsDialogModal() const { | 101 bool CertificateViewerDialog::IsDialogModal() const { |
| 96 return false; | 102 return false; |
| 97 } | 103 } |
| 98 | 104 |
| 99 string16 CertificateViewerDialog::GetDialogTitle() const { | 105 string16 CertificateViewerDialog::GetDialogTitle() const { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 cert_sub_fields->Append(node_details = new DictionaryValue()); | 421 cert_sub_fields->Append(node_details = new DictionaryValue()); |
| 416 node_details->SetString("label", | 422 node_details->SetString("label", |
| 417 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); | 423 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); |
| 418 node_details->SetString("payload.val", | 424 node_details->SetString("payload.val", |
| 419 x509_certificate_model::HashCertSHA1(cert)); | 425 x509_certificate_model::HashCertSHA1(cert)); |
| 420 | 426 |
| 421 // Send certificate information to javascript. | 427 // Send certificate information to javascript. |
| 422 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields", | 428 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields", |
| 423 root_list); | 429 root_list); |
| 424 } | 430 } |
| OLD | NEW |