Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / ui / webui / certificate_viewer_ui.cc
blob3c02b0af3cc46c37b2a96bc6cd2274d9bfc4069b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/certificate_viewer_ui.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/ui/webui/certificate_viewer_webui.h"
9 #include "chrome/common/url_constants.h"
10 #include "content/public/browser/render_view_host.h"
11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_ui.h"
13 #include "content/public/browser/web_ui_data_source.h"
14 #include "grit/browser_resources.h"
15 #include "grit/generated_resources.h"
16 #include "ui/web_dialogs/web_dialog_delegate.h"
18 namespace {
20 content::WebUIDataSource* GetWebUIDataSource(const std::string& host) {
21 content::WebUIDataSource* html_source =
22 content::WebUIDataSource::Create(host);
24 // Localized strings.
25 html_source->SetUseJsonJSFormatV2();
26 html_source->AddLocalizedString("general", IDS_CERT_INFO_GENERAL_TAB_LABEL);
27 html_source->AddLocalizedString("details", IDS_CERT_INFO_DETAILS_TAB_LABEL);
28 html_source->AddLocalizedString("close", IDS_CLOSE);
29 html_source->AddLocalizedString("export",
30 IDS_CERT_DETAILS_EXPORT_CERTIFICATE);
31 html_source->AddLocalizedString("usages",
32 IDS_CERT_INFO_VERIFIED_USAGES_GROUP);
33 html_source->AddLocalizedString("issuedTo", IDS_CERT_INFO_SUBJECT_GROUP);
34 html_source->AddLocalizedString("issuedBy", IDS_CERT_INFO_ISSUER_GROUP);
35 html_source->AddLocalizedString("cn", IDS_CERT_INFO_COMMON_NAME_LABEL);
36 html_source->AddLocalizedString("o", IDS_CERT_INFO_ORGANIZATION_LABEL);
37 html_source->AddLocalizedString("ou",
38 IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL);
39 html_source->AddLocalizedString("sn", IDS_CERT_INFO_SERIAL_NUMBER_LABEL);
40 html_source->AddLocalizedString("validity", IDS_CERT_INFO_VALIDITY_GROUP);
41 html_source->AddLocalizedString("issuedOn", IDS_CERT_INFO_ISSUED_ON_LABEL);
42 html_source->AddLocalizedString("expiresOn", IDS_CERT_INFO_EXPIRES_ON_LABEL);
43 html_source->AddLocalizedString("fingerprints",
44 IDS_CERT_INFO_FINGERPRINTS_GROUP);
45 html_source->AddLocalizedString("sha256",
46 IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL);
47 html_source->AddLocalizedString("sha1", IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL);
48 html_source->AddLocalizedString("hierarchy",
49 IDS_CERT_DETAILS_CERTIFICATE_HIERARCHY_LABEL);
50 html_source->AddLocalizedString("certFields",
51 IDS_CERT_DETAILS_CERTIFICATE_FIELDS_LABEL);
52 html_source->AddLocalizedString("certFieldVal",
53 IDS_CERT_DETAILS_CERTIFICATE_FIELD_VALUE_LABEL);
54 html_source->SetJsonPath("strings.js");
56 // Add required resources.
57 html_source->AddResourcePath("certificate_viewer.js",
58 IDR_CERTIFICATE_VIEWER_JS);
59 html_source->AddResourcePath("certificate_viewer.css",
60 IDR_CERTIFICATE_VIEWER_CSS);
61 html_source->SetDefaultResource(IDR_CERTIFICATE_VIEWER_HTML);
62 return html_source;
65 } // namespace
67 CertificateViewerModalDialogUI::CertificateViewerModalDialogUI(
68 content::WebUI* web_ui)
69 : ui::WebDialogUI(web_ui) {
70 // Set up the chrome://view-cert-dialog source.
71 Profile* profile = Profile::FromWebUI(web_ui);
72 content::WebUIDataSource::Add(
73 profile,
74 GetWebUIDataSource(chrome::kChromeUICertificateViewerDialogHost));
77 CertificateViewerModalDialogUI::~CertificateViewerModalDialogUI() {
80 CertificateViewerUI::CertificateViewerUI(content::WebUI* web_ui)
81 : ConstrainedWebDialogUI(web_ui) {
82 // Set up the chrome://view-cert source.
83 Profile* profile = Profile::FromWebUI(web_ui);
84 content::WebUIDataSource::Add(
85 profile,
86 GetWebUIDataSource(chrome::kChromeUICertificateViewerHost));
89 CertificateViewerUI::~CertificateViewerUI() {