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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java

Issue 1474483004: WebView Metrics client implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments on address of comments from #5 Created 5 years 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: 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);
+}

Powered by Google App Engine
This is Rietveld 408576698