OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.pm.PackageManager; | 8 import android.content.pm.PackageManager; |
9 | 9 |
10 import org.chromium.base.ApiCompatibilityUtils; | 10 import org.chromium.base.ApiCompatibilityUtils; |
11 import org.chromium.base.annotations.CalledByNative; | 11 import org.chromium.base.annotations.CalledByNative; |
12 | 12 |
13 /** | 13 /** |
14 * Controller for Remote Web Debugging (Developer Tools). | 14 * Controller for Remote Web Debugging (Developer Tools). |
15 */ | 15 */ |
16 public class DevToolsServer { | 16 public class DevToolsServer { |
17 private static final String DEBUG_PERMISSION_SIFFIX = ".permission.DEBUG"; | 17 private static final String DEBUG_PERMISSION_SIFFIX = ".permission.DEBUG"; |
18 | 18 |
19 private long mNativeDevToolsServer = 0; | 19 private long mNativeDevToolsServer; |
20 | 20 |
21 // Defines what processes may access to the socket. | 21 // Defines what processes may access to the socket. |
22 public enum Security { | 22 public enum Security { |
23 // Use content::CanUserConnectToDevTools to authorize access to the sock
et. | 23 // Use content::CanUserConnectToDevTools to authorize access to the sock
et. |
24 DEFAULT, | 24 DEFAULT, |
25 | 25 |
26 // In addition to default authorization allows access to an app with and
roid permission | 26 // In addition to default authorization allows access to an app with and
roid permission |
27 // named chromeAppPackageName + DEBUG_PERMISSION_SIFFIX. | 27 // named chromeAppPackageName + DEBUG_PERMISSION_SIFFIX. |
28 ALLOW_DEBUG_PERMISSION, | 28 ALLOW_DEBUG_PERMISSION, |
29 } | 29 } |
(...skipping 26 matching lines...) Expand all Loading... |
56 private native void nativeSetRemoteDebuggingEnabled( | 56 private native void nativeSetRemoteDebuggingEnabled( |
57 long devToolsServer, boolean enabled, boolean allowDebugPermission); | 57 long devToolsServer, boolean enabled, boolean allowDebugPermission); |
58 | 58 |
59 @CalledByNative | 59 @CalledByNative |
60 private static boolean checkDebugPermission(Context context, int pid, int ui
d) { | 60 private static boolean checkDebugPermission(Context context, int pid, int ui
d) { |
61 String debugPermissionName = context.getPackageName() + DEBUG_PERMISSION
_SIFFIX; | 61 String debugPermissionName = context.getPackageName() + DEBUG_PERMISSION
_SIFFIX; |
62 return ApiCompatibilityUtils.checkPermission(context, debugPermissionNam
e, pid, uid) | 62 return ApiCompatibilityUtils.checkPermission(context, debugPermissionNam
e, pid, uid) |
63 == PackageManager.PERMISSION_GRANTED; | 63 == PackageManager.PERMISSION_GRANTED; |
64 } | 64 } |
65 } | 65 } |
OLD | NEW |