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

Unified Diff: components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java

Issue 746663002: Stub for WebRTCDeviceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webclient
Patch Set: Created 6 years, 1 month 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: components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java
diff --git a/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java b/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java
index 896710edd17790b454f05de9343634dae6ec4816..5d6b2f97c86303fc90115435010de1ef438edd95 100644
--- a/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java
+++ b/components/devtools_bridge/test/android/client/javatests/src/org/chromium/components/devtools_bridge/WebClient.java
@@ -4,6 +4,7 @@
package org.chromium.components.devtools_bridge;
+import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.chrome.browser.profiles.Profile;
@@ -14,14 +15,42 @@ import org.chromium.chrome.browser.profiles.Profile;
public final class WebClient {
private final long mWebClientPtr;
- public WebClient(Profile profile) {
- mWebClientPtr = nativeCreateWebClient(profile);
+ /**
+ * Delegate of the web client.
+ */
+ public interface Delegate {
+ void sendCommand(String json);
+ }
+
+ public WebClient(Profile profile, Delegate delegate) {
+ mWebClientPtr = nativeCreateWebClient(profile, delegate);
+ }
+
+ public void connect(String deviceId) {
+ nativeConnect(mWebClientPtr, deviceId);
+ }
+
+ public void disconnect(String deviceId) {
+ nativeDisconnect(mWebClientPtr, deviceId);
+ }
+
+ public void disconnectAll() {
+ nativeDisconnectAll(mWebClientPtr);
}
public void dispose() {
nativeDestroyWebClient(mWebClientPtr);
}
- private static native long nativeCreateWebClient(Profile profile);
+ @CalledByNative
+ static void sendCommand(Object delegate, String json) {
+ ((Delegate) delegate).sendCommand(json);
+ }
+
+ private static native long nativeCreateWebClient(Profile profile, Object delegate);
private static native void nativeDestroyWebClient(long webClientPtr);
+
+ private static native void nativeConnect(long webClientPtr, String deviceId);
+ private static native void nativeDisconnect(long webClientPtr, String deviceId);
+ private static native void nativeDisconnectAll(long webClientPtr);
}

Powered by Google App Engine
This is Rietveld 408576698