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