| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { | 76 bool ToolbarModelAndroid::RegisterToolbarModelAndroid(JNIEnv* env) { |
| 77 return RegisterNativesImpl(env); | 77 return RegisterNativesImpl(env); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { | 81 jlong Init(JNIEnv* env, jobject obj, jobject delegate) { |
| 82 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); | 82 ToolbarModelAndroid* toolbar_model = new ToolbarModelAndroid(env, delegate); |
| 83 return reinterpret_cast<intptr_t>(toolbar_model); | 83 return reinterpret_cast<intptr_t>(toolbar_model); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // static | |
| 87 jint GetSecurityLevelForWebContents(JNIEnv* env, | |
| 88 jclass jcaller, | |
| 89 jobject jweb_contents) { | |
| 90 content::WebContents* web_contents = | |
| 91 content::WebContents::FromJavaWebContents(jweb_contents); | |
| 92 DCHECK(web_contents); | |
| 93 return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents); | |
| 94 } | |
| 95 | |
| 96 // Temporary method to allow us to surface a SHA-1 deprecation string on Android | 86 // Temporary method to allow us to surface a SHA-1 deprecation string on Android |
| 97 // in M42. This duplicates a subset of the logic from | 87 // in M42. This duplicates a subset of the logic from |
| 98 // ToolbarModelImpl::GetSecurityLevelForWebContents() and | 88 // ToolbarModelImpl::GetSecurityLevelForWebContents() and |
| 99 // WebsiteSettings::Init(), which should really be refactored. | 89 // WebsiteSettings::Init(), which should really be refactored. |
| 100 // This is at the wrong layer, and needs to be refactored (along with desktop): | 90 // This is at the wrong layer, and needs to be refactored (along with desktop): |
| 101 // https://crbug.com/471390 | 91 // https://crbug.com/471390 |
| 102 | 92 |
| 103 // static | 93 // static |
| 104 jboolean IsDeprecatedSHA1Present(JNIEnv* env, | 94 jboolean IsDeprecatedSHA1Present(JNIEnv* env, |
| 105 jclass jcaller, | 95 jclass jcaller, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 // ToolbarModelImpl::GetSecurityLevelForWebContents(). | 110 // ToolbarModelImpl::GetSecurityLevelForWebContents(). |
| 121 static const int64_t kJanuary2016 = INT64_C(13096080000000000); | 111 static const int64_t kJanuary2016 = INT64_C(13096080000000000); |
| 122 if (content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) && | 112 if (content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) && |
| 123 (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) && | 113 (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT) && |
| 124 cert->valid_expiry() > base::Time::FromInternalValue(kJanuary2016)) { | 114 cert->valid_expiry() > base::Time::FromInternalValue(kJanuary2016)) { |
| 125 return true; | 115 return true; |
| 126 } | 116 } |
| 127 } | 117 } |
| 128 return false; | 118 return false; |
| 129 } | 119 } |
| OLD | NEW |