OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ssl/security_state_model_android.h" | 5 #include "chrome/browser/ssl/security_state_model_android.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/ssl/security_state_model.h" | 8 #include "chrome/browser/ssl/chrome_security_state_model_delegate.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "jni/SecurityStateModel_jni.h" | 10 #include "jni/SecurityStateModel_jni.h" |
11 | 11 |
12 // static | 12 // static |
13 bool RegisterSecurityStateModelAndroid(JNIEnv* env) { | 13 bool RegisterSecurityStateModelAndroid(JNIEnv* env) { |
14 return RegisterNativesImpl(env); | 14 return RegisterNativesImpl(env); |
15 } | 15 } |
16 | 16 |
17 // static | 17 // static |
18 jint GetSecurityLevelForWebContents( | 18 jint GetSecurityLevelForWebContents( |
19 JNIEnv* env, | 19 JNIEnv* env, |
20 const JavaParamRef<jclass>& jcaller, | 20 const JavaParamRef<jclass>& jcaller, |
21 const JavaParamRef<jobject>& jweb_contents) { | 21 const JavaParamRef<jobject>& jweb_contents) { |
22 content::WebContents* web_contents = | 22 content::WebContents* web_contents = |
23 content::WebContents::FromJavaWebContents(jweb_contents); | 23 content::WebContents::FromJavaWebContents(jweb_contents); |
24 DCHECK(web_contents); | 24 DCHECK(web_contents); |
25 SecurityStateModel::CreateForWebContents(web_contents); | 25 ChromeSecurityStateModelDelegate::CreateForWebContents(web_contents); |
26 SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents); | 26 ChromeSecurityStateModelDelegate* model_delegate = |
27 DCHECK(model); | 27 ChromeSecurityStateModelDelegate::FromWebContents(web_contents); |
28 return model->GetSecurityInfo().security_level; | 28 DCHECK(model_delegate); |
| 29 return model_delegate->GetSecurityInfo().security_level; |
29 } | 30 } |
30 | 31 |
31 // static | 32 // static |
32 jboolean IsDeprecatedSHA1Present(JNIEnv* env, | 33 jboolean IsDeprecatedSHA1Present(JNIEnv* env, |
33 const JavaParamRef<jclass>& jcaller, | 34 const JavaParamRef<jclass>& jcaller, |
34 const JavaParamRef<jobject>& jweb_contents) { | 35 const JavaParamRef<jobject>& jweb_contents) { |
35 content::WebContents* web_contents = | 36 content::WebContents* web_contents = |
36 content::WebContents::FromJavaWebContents(jweb_contents); | 37 content::WebContents::FromJavaWebContents(jweb_contents); |
37 DCHECK(web_contents); | 38 DCHECK(web_contents); |
38 SecurityStateModel::CreateForWebContents(web_contents); | 39 ChromeSecurityStateModelDelegate::CreateForWebContents(web_contents); |
39 SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents); | 40 ChromeSecurityStateModelDelegate* model_delegate = |
40 DCHECK(model); | 41 ChromeSecurityStateModelDelegate::FromWebContents(web_contents); |
41 return model->GetSecurityInfo().sha1_deprecation_status != | 42 DCHECK(model_delegate); |
42 SecurityStateModel::NO_DEPRECATED_SHA1; | 43 return model_delegate->GetSecurityInfo().sha1_deprecation_status != |
| 44 security_state::NO_DEPRECATED_SHA1; |
43 } | 45 } |
44 | 46 |
45 // static | 47 // static |
46 jboolean IsPassiveMixedContentPresent( | 48 jboolean IsPassiveMixedContentPresent( |
47 JNIEnv* env, | 49 JNIEnv* env, |
48 const JavaParamRef<jclass>& jcaller, | 50 const JavaParamRef<jclass>& jcaller, |
49 const JavaParamRef<jobject>& jweb_contents) { | 51 const JavaParamRef<jobject>& jweb_contents) { |
50 content::WebContents* web_contents = | 52 content::WebContents* web_contents = |
51 content::WebContents::FromJavaWebContents(jweb_contents); | 53 content::WebContents::FromJavaWebContents(jweb_contents); |
52 DCHECK(web_contents); | 54 DCHECK(web_contents); |
53 SecurityStateModel::CreateForWebContents(web_contents); | 55 ChromeSecurityStateModelDelegate::CreateForWebContents(web_contents); |
54 SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents); | 56 ChromeSecurityStateModelDelegate* model_delegate = |
55 DCHECK(model); | 57 ChromeSecurityStateModelDelegate::FromWebContents(web_contents); |
56 return model->GetSecurityInfo().mixed_content_status == | 58 DCHECK(model_delegate); |
57 SecurityStateModel::DISPLAYED_MIXED_CONTENT || | 59 return model_delegate->GetSecurityInfo().mixed_content_status == |
58 model->GetSecurityInfo().mixed_content_status == | 60 security_state::DISPLAYED_MIXED_CONTENT || |
59 SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; | 61 model_delegate->GetSecurityInfo().mixed_content_status == |
| 62 security_state::RAN_AND_DISPLAYED_MIXED_CONTENT; |
60 } | 63 } |
OLD | NEW |