Index: android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java |
diff --git a/android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java b/android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7775fb290984238690d70bdb3c6c78e008a65d0e |
--- /dev/null |
+++ b/android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java |
@@ -0,0 +1,29 @@ |
+// Copyright 2015 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.android_webview; |
+ |
+import android.content.Context; |
+import android.webkit.ValueCallback; |
+ |
+import org.chromium.base.annotations.JNINamespace; |
+ |
+/** |
+ * Java twin of the homonymous C++ class. The Java side is only responsible for |
+ * switching metrics on and off. Since the setting is a platform feature, it |
+ * must be obtained through PlatformServiceBridge. |
+ */ |
+@JNINamespace("android_webview") |
+public class AwMetricsServiceClient { |
+ public AwMetricsServiceClient(Context applicationContext) { |
+ PlatformServiceBridge.getInstance(applicationContext) |
+ .setMetricsSettingListener(new ValueCallback<Boolean>() { |
+ public void onReceiveValue(Boolean enabled) { |
+ nativeSetMetricsEnabled(enabled); |
+ } |
+ }); |
+ } |
+ |
+ public static native void nativeSetMetricsEnabled(boolean enabled); |
+} |