Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1715)

Unified Diff: chrome/browser/ssl/security_state_model_android.cc

Issue 1314843007: Refactor connection_security into SecurityStateModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avi comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/security_state_model_android.cc
diff --git a/chrome/browser/ssl/security_state_model_android.cc b/chrome/browser/ssl/security_state_model_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b19da829a33dd3510432ad9fab65d00ddd16a40d
--- /dev/null
+++ b/chrome/browser/ssl/security_state_model_android.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ssl/security_state_model_android.h"
+
+#include "base/logging.h"
+#include "chrome/browser/ssl/security_state_model.h"
+#include "content/public/browser/web_contents.h"
+#include "jni/SecurityStateModel_jni.h"
+
+// static
+bool RegisterSecurityStateModelAndroid(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+// static
+void SecurityStateChanged(JNIEnv* env, jclass jcaller, jobject jweb_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(jweb_contents);
+ DCHECK(web_contents);
+ SecurityStateModel::CreateForWebContents(web_contents);
Ted C 2015/09/04 00:36:50 why do we need to create them here? TabAndroid ca
estark 2015/09/04 16:53:09 Done.
+ SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents);
+ DCHECK(model);
+ model->SecurityStateChanged();
+}
+
+// static
+jint GetSecurityLevelForWebContents(JNIEnv* env,
+ jclass jcaller,
+ jobject jweb_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(jweb_contents);
+ DCHECK(web_contents);
+ SecurityStateModel::CreateForWebContents(web_contents);
+ SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents);
+ DCHECK(model);
+ return model->security_info().security_level;
+}
+
+// static
+jboolean IsDeprecatedSHA1Present(JNIEnv* env,
+ jclass jcaller,
+ jobject jweb_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(jweb_contents);
+ DCHECK(web_contents);
+ SecurityStateModel::CreateForWebContents(web_contents);
+ SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents);
+ DCHECK(model);
+ return model->security_info().sha1_deprecation_status !=
+ SecurityStateModel::NO_DEPRECATED_SHA1;
+}
+
+// static
+jboolean IsPassiveMixedContentPresent(JNIEnv* env,
+ jclass jcaller,
+ jobject jweb_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(jweb_contents);
+ DCHECK(web_contents);
+ SecurityStateModel::CreateForWebContents(web_contents);
+ SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents);
+ DCHECK(model);
+ return model->security_info().mixed_content_status ==
+ SecurityStateModel::DISPLAYED_MIXED_CONTENT ||
+ model->security_info().mixed_content_status ==
+ SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT;
+}

Powered by Google App Engine
This is Rietveld 408576698