Chromium Code Reviews

Side by Side Diff: chrome/browser/ui/webui/certificate_viewer.cc

Issue 8479042: UI polish for certificate viewer (Closed) Base URL: /usr/local/google/home/bshe/NoTouchChromium/../TouchChromium/src/@trunk
Patch Set: Add x button and remove padding and close button for certificate viewer. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/certificate_viewer.h" 10 #include "chrome/browser/certificate_viewer.h"
(...skipping 33 matching lines...)
44 else 44 else
45 ShowNativeCertificateViewer(parent, cert); 45 ShowNativeCertificateViewer(parent, cert);
46 #endif 46 #endif
47 } 47 }
48 48
49 //////////////////////////////////////////////////////////////////////////////// 49 ////////////////////////////////////////////////////////////////////////////////
50 // CertificateViewerDialog 50 // CertificateViewerDialog
51 51
52 void CertificateViewerDialog::ShowDialog(gfx::NativeWindow parent, 52 void CertificateViewerDialog::ShowDialog(gfx::NativeWindow parent,
53 net::X509Certificate* cert) { 53 net::X509Certificate* cert) {
54 #if defined(OS_CHROMEOS)
55 CertificateViewerDialog* dialog = new CertificateViewerDialog(cert,
56 chromeos::STYLE_CERT);
57 #else
54 CertificateViewerDialog* dialog = new CertificateViewerDialog(cert); 58 CertificateViewerDialog* dialog = new CertificateViewerDialog(cert);
59 #endif
55 dialog->Show(parent); 60 dialog->Show(parent);
56 } 61 }
57 62
63 #if defined(OS_CHROMEOS)
64 CertificateViewerDialog::CertificateViewerDialog(net::X509Certificate* cert,
65 chromeos::BubbleWindowStyle style)
66 : cert_(cert), window_(NULL), style_(style) {
67 #else
58 CertificateViewerDialog::CertificateViewerDialog(net::X509Certificate* cert) 68 CertificateViewerDialog::CertificateViewerDialog(net::X509Certificate* cert)
59 : cert_(cert), window_(NULL) { 69 : cert_(cert), window_(NULL) {
60 // Construct the dialog title from the certificate. 70 #endif
71 // Construct the dialog title from the certificate.
61 net::X509Certificate::OSCertHandles cert_chain; 72 net::X509Certificate::OSCertHandles cert_chain;
62 x509_certificate_model::GetCertChainFromCert(cert_->os_cert_handle(), 73 x509_certificate_model::GetCertChainFromCert(cert_->os_cert_handle(),
63 &cert_chain); 74 &cert_chain);
64 title_ = l10n_util::GetStringFUTF16(IDS_CERT_INFO_DIALOG_TITLE, 75 title_ = l10n_util::GetStringFUTF16(IDS_CERT_INFO_DIALOG_TITLE,
65 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front()))); 76 UTF8ToUTF16(x509_certificate_model::GetTitle(cert_chain.front())));
66 } 77 }
67 78
68 CertificateViewerDialog::~CertificateViewerDialog() { 79 CertificateViewerDialog::~CertificateViewerDialog() {
69 } 80 }
70 81
71 void CertificateViewerDialog::Show(gfx::NativeWindow parent) { 82 void CertificateViewerDialog::Show(gfx::NativeWindow parent) {
72 Browser* browser = BrowserList::GetLastActive(); 83 Browser* browser = BrowserList::GetLastActive();
73 DCHECK(browser); 84 DCHECK(browser);
85 #if defined(OS_CHROMEOS)
86 window_ = browser->BrowserShowHtmlDialog(this, parent, style_);
flackr 2011/11/10 16:03:16 Assuming the rename I suggested earlier and using
bshe 2011/11/21 16:09:37 Done.
87 #else
74 window_ = browser->BrowserShowHtmlDialog(this, parent); 88 window_ = browser->BrowserShowHtmlDialog(this, parent);
89 #endif
75 } 90 }
76 91
77 bool CertificateViewerDialog::IsDialogModal() const { 92 bool CertificateViewerDialog::IsDialogModal() const {
78 return false; 93 return false;
79 } 94 }
80 95
81 string16 CertificateViewerDialog::GetDialogTitle() const { 96 string16 CertificateViewerDialog::GetDialogTitle() const {
82 return title_; 97 return title_;
83 } 98 }
84 99
(...skipping 312 matching lines...)
397 cert_sub_fields->Append(node_details = new DictionaryValue()); 412 cert_sub_fields->Append(node_details = new DictionaryValue());
398 node_details->SetString("label", 413 node_details->SetString("label",
399 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)); 414 l10n_util::GetStringUTF8(IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL));
400 node_details->SetString("payload.val", 415 node_details->SetString("payload.val",
401 x509_certificate_model::HashCertSHA1(cert)); 416 x509_certificate_model::HashCertSHA1(cert));
402 417
403 // Send certificate information to javascript. 418 // Send certificate information to javascript.
404 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields", 419 web_ui_->CallJavascriptFunction("cert_viewer.getCertificateFields",
405 root_list); 420 root_list);
406 } 421 }
OLDNEW
« chrome/browser/ui/webui/certificate_viewer.h ('K') | « chrome/browser/ui/webui/certificate_viewer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine