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

Unified Diff: content/public/android/java/org/chromium/content/browser/RemoteDebuggingController.java

Issue 10540094: Add RemoteDebuggingController.java and its (native) dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move devtools_server.h to content/public Created 8 years, 6 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: content/public/android/java/org/chromium/content/browser/RemoteDebuggingController.java
diff --git a/content/public/android/java/org/chromium/content/browser/RemoteDebuggingController.java b/content/public/android/java/org/chromium/content/browser/RemoteDebuggingController.java
new file mode 100644
index 0000000000000000000000000000000000000000..d618530d4a484064f75246c2e39f5032b238ab17
--- /dev/null
+++ b/content/public/android/java/org/chromium/content/browser/RemoteDebuggingController.java
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 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.content.browser;
+
+// Controls DevTools remote debugging server state.
+public class RemoteDebuggingController {
+
+ private static RemoteDebuggingController sInstance;
+
+ private boolean mUserPreferenceEnabled;
+
+ public static RemoteDebuggingController getInstance() {
+ if (sInstance == null) {
+ sInstance = new RemoteDebuggingController();
+ }
+ return sInstance;
+ }
+
+ public void updateUserPreferenceState(boolean enabled) {
+ if (mUserPreferenceEnabled != enabled) {
+ mUserPreferenceEnabled = enabled;
+ updateRemoteDebuggingState();
+ }
+ }
+
+ void updateRemoteDebuggingState() {
+ if (mUserPreferenceEnabled != nativeIsRemoteDebuggingEnabled()) {
+ if (mUserPreferenceEnabled) {
+ nativeStartRemoteDebugging();
+ } else {
+ nativeStopRemoteDebugging();
+ }
+ }
+ }
+
+ private RemoteDebuggingController() {
+ mUserPreferenceEnabled = nativeIsRemoteDebuggingEnabled();
+ }
+
+ private static native void nativeStartRemoteDebugging();
+ private static native void nativeStopRemoteDebugging();
+ private static native boolean nativeIsRemoteDebuggingEnabled();
+}

Powered by Google App Engine
This is Rietveld 408576698