Commit 40f47c58 authored by Marcin Wiacek's avatar Marcin Wiacek Committed by Commit Bot

Replace enum Security with @IntDef

Change-Id: I9a3a58b3ee2207816ac0f2f96fa21e464d1da866
Reviewed-on: https://chromium-review.googlesource.com/1125066
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572562}
parent 40491101
......@@ -5,11 +5,15 @@
package org.chromium.chrome.browser;
import android.content.pm.PackageManager;
import android.support.annotation.IntDef;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ContextUtils;
import org.chromium.base.annotations.CalledByNative;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Controller for Remote Web Debugging (Developer Tools).
*/
......@@ -19,13 +23,14 @@ public class DevToolsServer {
private long mNativeDevToolsServer;
// Defines what processes may access to the socket.
public enum Security {
@IntDef({Security.DEFAULT, Security.ALLOW_DEBUG_PERMISSION})
@Retention(RetentionPolicy.SOURCE)
public @interface Security {
// Use content::CanUserConnectToDevTools to authorize access to the socket.
DEFAULT,
int DEFAULT = 0;
// In addition to default authorization allows access to an app with android permission
// named chromeAppPackageName + DEBUG_PERMISSION_SIFFIX.
ALLOW_DEBUG_PERMISSION,
int ALLOW_DEBUG_PERMISSION = 1;
}
public DevToolsServer(String socketNamePrefix) {
......@@ -41,7 +46,7 @@ public class DevToolsServer {
return nativeIsRemoteDebuggingEnabled(mNativeDevToolsServer);
}
public void setRemoteDebuggingEnabled(boolean enabled, Security security) {
public void setRemoteDebuggingEnabled(boolean enabled, @Security int security) {
boolean allowDebugPermission = security == Security.ALLOW_DEBUG_PERMISSION;
nativeSetRemoteDebuggingEnabled(mNativeDevToolsServer, enabled, allowDebugPermission);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment