Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / android / certificate_viewer_android.cc
blob7a76139e508b262afef67c78213c735a62c2ec85
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/certificate_viewer.h"
7 #include "base/android/jni_string.h"
8 #include "base/logging.h"
9 #include "grit/generated_resources.h"
10 #include "jni/CertificateViewer_jni.h"
11 #include "net/cert/x509_certificate.h"
12 #include "ui/base/l10n/l10n_util.h"
14 using base::android::ConvertUTF8ToJavaString;
15 using base::android::ScopedJavaLocalRef;
17 void ShowCertificateViewer(content::WebContents* web_contents,
18 gfx::NativeWindow parent,
19 net::X509Certificate* cert) {
20 // For Android, showing the certificate is always handled in Java.
21 NOTREACHED();
24 static jstring GetCertIssuedToText(JNIEnv* env, jclass) {
25 return ConvertUTF8ToJavaString(
26 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_SUBJECT_GROUP)).Release();
29 static jstring GetCertInfoCommonNameText(JNIEnv* env, jclass) {
30 return ConvertUTF8ToJavaString(
31 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_COMMON_NAME_LABEL)).Release();
34 static jstring GetCertInfoOrganizationText(JNIEnv* env, jclass) {
35 return ConvertUTF8ToJavaString(
36 env, l10n_util::GetStringUTF8(
37 IDS_CERT_INFO_ORGANIZATION_LABEL)).Release();
40 static jstring GetCertInfoSerialNumberText(JNIEnv* env, jclass) {
41 return ConvertUTF8ToJavaString(
42 env, l10n_util::GetStringUTF8(
43 IDS_CERT_INFO_SERIAL_NUMBER_LABEL)).Release();
46 static jstring GetCertInfoOrganizationUnitText(JNIEnv* env, jclass) {
47 return ConvertUTF8ToJavaString(
48 env, l10n_util::GetStringUTF8(
49 IDS_CERT_INFO_ORGANIZATIONAL_UNIT_LABEL)).Release();
52 static jstring GetCertIssuedByText(JNIEnv* env, jclass) {
53 return ConvertUTF8ToJavaString(
54 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUER_GROUP)).Release();
57 static jstring GetCertValidityText(JNIEnv* env, jclass) {
58 return ConvertUTF8ToJavaString(
59 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_VALIDITY_GROUP)).Release();
62 static jstring GetCertIssuedOnText(JNIEnv* env, jclass) {
63 return ConvertUTF8ToJavaString(
64 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_ISSUED_ON_LABEL)).Release();
67 static jstring GetCertExpiresOnText(JNIEnv* env, jclass) {
68 return ConvertUTF8ToJavaString(
69 env, l10n_util::GetStringUTF8(IDS_CERT_INFO_EXPIRES_ON_LABEL)).Release();
72 static jstring GetCertFingerprintsText(JNIEnv* env, jclass) {
73 return ConvertUTF8ToJavaString(
74 env, l10n_util::GetStringUTF8(
75 IDS_CERT_INFO_FINGERPRINTS_GROUP)).Release();
78 static jstring GetCertSHA256FingerprintText(JNIEnv* env, jclass) {
79 return ConvertUTF8ToJavaString(
80 env, l10n_util::GetStringUTF8(
81 IDS_CERT_INFO_SHA256_FINGERPRINT_LABEL)).Release();
84 static jstring GetCertSHA1FingerprintText(JNIEnv* env, jclass) {
85 return ConvertUTF8ToJavaString(
86 env, l10n_util::GetStringUTF8(
87 IDS_CERT_INFO_SHA1_FINGERPRINT_LABEL)).Release();
90 bool RegisterCertificateViewer(JNIEnv* env) {
91 return RegisterNativesImpl(env);