forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor connection_security into SecurityStateModel
This CL refactors the connection_security namespace (a namespace of statics) into SecurityStateModel, a class attached to a WebContents that drives the security UI for that WebContents. The SecurityStateModel provides high-level security information about a page or request, with the goal of reducing code duplication across various security UI elements. In this first CL, I've introduced the SecurityStateModel and am using it to drive the omnibox/lock icon, but have not yet adapted WebsiteSettings to use a SecurityStateModel. BUG=528034 TBR=sky@chromium.org Review URL: https://codereview.chromium.org/1314843007 Cr-Commit-Position: refs/heads/master@{#347775}
- Loading branch information
estark
authored and
Commit bot
committed
Sep 8, 2015
1 parent
d4599b4
commit 83a81af
Showing
46 changed files
with
922 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
chrome/android/java/src/org/chromium/chrome/browser/ssl/ConnectionSecurity.java
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
chrome/android/java/src/org/chromium/chrome/browser/ssl/SecurityStateModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// 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. | ||
|
||
package org.chromium.chrome.browser.ssl; | ||
|
||
import org.chromium.content_public.browser.WebContents; | ||
|
||
/** | ||
* Provides a way of accessing helpers for page security state. | ||
*/ | ||
public class SecurityStateModel { | ||
/** | ||
* Fetch the security level for a given web contents. | ||
* | ||
* @param webContents The web contents to get the security level for. | ||
* @return The ConnectionSecurityLevel for the specified web contents. | ||
* | ||
* @see ConnectionSecurityLevel | ||
*/ | ||
public static int getSecurityLevelForWebContents(WebContents webContents) { | ||
if (webContents == null) return ConnectionSecurityLevel.NONE; | ||
return nativeGetSecurityLevelForWebContents(webContents); | ||
} | ||
|
||
/** | ||
* @param webContents The web contents to query for deprecated SHA-1 presence. | ||
* @return Whether the security level of the page was deprecated due to SHA-1. | ||
*/ | ||
public static boolean isDeprecatedSHA1Present(WebContents webContents) { | ||
if (webContents == null) return false; | ||
return nativeIsDeprecatedSHA1Present(webContents); | ||
} | ||
|
||
/** | ||
* @param webContents The web contents to query for passive mixed content presence. | ||
* @return Whether the page contains passive mixed content. | ||
*/ | ||
public static boolean isPassiveMixedContentPresent(WebContents webContents) { | ||
if (webContents == null) return false; | ||
return nativeIsPassiveMixedContentPresent(webContents); | ||
} | ||
|
||
private SecurityStateModel() {} | ||
|
||
private static native int nativeGetSecurityLevelForWebContents(WebContents webContents); | ||
private static native boolean nativeIsDeprecatedSHA1Present(WebContents webContents); | ||
private static native boolean nativeIsPassiveMixedContentPresent(WebContents webContents); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.