OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/toolbar/toolbar_model_android.h" | 5 #include "chrome/browser/ui/android/toolbar/toolbar_model_android.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { | 63 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { |
64 return RegisterNativesImpl(env); | 64 return RegisterNativesImpl(env); |
65 } | 65 } |
66 | 66 |
67 // static | 67 // static |
68 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { | 68 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { |
69 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); | 69 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); |
70 return reinterpret_cast<intptr_t>(toolbar_model); | 70 return reinterpret_cast<intptr_t>(toolbar_model); |
71 } | 71 } |
72 | 72 |
73 // static | |
74 jint GetSecurityLevelForWebContents(JNIEnv* env, | |
75 jclass jcaller, | |
76 jobject jweb_contents) { | |
77 content::WebContents* web_contents = | |
78 content::WebContents::FromJavaWebContents(jweb_contents); | |
79 DCHECK(web_contents); | |
80 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents); | |
81 } | |
82 | |
83 // Temporary method to allow us to surface a SHA-1 deprecation string on Android | 73 // Temporary method to allow us to surface a SHA-1 deprecation string on Android |
84 // in M42. This duplicates a subset of the logic from | 74 // in M42. This duplicates a subset of the logic from |
85 // ToolbarModelImpl::GetSecurityLevelForWebContents() and | 75 // ToolbarModelImpl::GetSecurityLevelForWebContents() and |
86 // WebsiteSettings::Init(), which should really be refactored. | 76 // WebsiteSettings::Init(), which should really be refactored. |
87 // This is at the wrong layer, and needs to be refactored (along with desktop): | 77 // This is at the wrong layer, and needs to be refactored (along with desktop): |
88 // https://crbug.com/471390 | 78 // https://crbug.com/471390 |
89 | 79 |
90 // static | 80 // static |
91 jboolean IsDeprecatedSHA1Present(JNIEnv* env, | 81 jboolean IsDeprecatedSHA1Present(JNIEnv* env, |
92 jclass jcaller, | 82 jclass jcaller, |
(...skipping 14 matching lines...) Expand all Loading... |
107 // ToolbarModelImpl::GetSecurityLevelForWebContents(). | 97 // ToolbarModelImpl::GetSecurityLevelForWebContents(). |
108 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | 98 static const int64_t kJanuary2016 = INT64_C(13096080000000000); |
109 if (content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) && | 99 if (content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) && |
110 (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) && | 100 (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) && |
111 cert->valid_expiry() > base::Time::FromInternalValue(kJanuary2016)) { | 101 cert->valid_expiry() > base::Time::FromInternalValue(kJanuary2016)) { |
112 return true; | 102 return true; |
113 } | 103 } |
114 } | 104 } |
115 return false; | 105 return false; |
116 } | 106 } |
OLD | NEW |