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..93ca5962700cfc22bd3131aac8e2538e21f6853a |
--- /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.booleanValue()); |
sgurun-gerrit only
2015/12/21 21:47:26
java unboxing takes care of that. drop .booleanval
paulmiller
2015/12/22 19:42:04
done
|
+ } |
+ }); |
+ } |
+ |
+ public static native void nativeSetMetricsEnabled(boolean enabled); |
+} |