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

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: rebase Created 4 years, 11 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: 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);
+}

Powered by Google App Engine
This is Rietveld 408576698