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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/DevToolsServer.java

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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;
8 import android.content.pm.PackageManager; 7 import android.content.pm.PackageManager;
9 8
10 import org.chromium.base.ApiCompatibilityUtils; 9 import org.chromium.base.ApiCompatibilityUtils;
10 import org.chromium.base.ContextUtils;
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; 19 private long mNativeDevToolsServer;
20 20
(...skipping 29 matching lines...) Expand all
50 setRemoteDebuggingEnabled(enabled, Security.DEFAULT); 50 setRemoteDebuggingEnabled(enabled, Security.DEFAULT);
51 } 51 }
52 52
53 private native long nativeInitRemoteDebugging(String socketNamePrefix); 53 private native long nativeInitRemoteDebugging(String socketNamePrefix);
54 private native void nativeDestroyRemoteDebugging(long devToolsServer); 54 private native void nativeDestroyRemoteDebugging(long devToolsServer);
55 private native boolean nativeIsRemoteDebuggingEnabled(long devToolsServer); 55 private native boolean nativeIsRemoteDebuggingEnabled(long devToolsServer);
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(int pid, int uid) {
61 String debugPermissionName = context.getPackageName() + DEBUG_PERMISSION _SIFFIX; 61 String debugPermissionName =
62 return ApiCompatibilityUtils.checkPermission(context, debugPermissionNam e, pid, uid) 62 ContextUtils.getApplicationContext().getPackageName() + DEBUG_PE RMISSION_SIFFIX;
63 return ApiCompatibilityUtils.checkPermission(
64 ContextUtils.getApplicationContext(), debugPermissionName , pid, uid)
63 == PackageManager.PERMISSION_GRANTED; 65 == PackageManager.PERMISSION_GRANTED;
64 } 66 }
65 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698