Index: chromecast/base/java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java |
diff --git a/chromecast/base/java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java b/chromecast/base/java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ba714dbeac9e767270a68f87ad880ae1c782528c |
--- /dev/null |
+++ b/chromecast/base/java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java |
@@ -0,0 +1,37 @@ |
+// 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.chromecast.base; |
+ |
+import android.content.Context; |
+ |
+import org.chromium.base.CalledByNative; |
+import org.chromium.base.JNINamespace; |
+ |
+/** |
+ * JNI wrapper class for calls from ChromecastConfigAndroid. |
+ */ |
+@JNINamespace("chromecast::android") |
+public final class ChromecastConfigAndroid { |
+ |
+ private static CastSettingsManager sSettingsManager; |
+ |
+ public static void initializeForBrowser(Context applicationContext) { |
+ sSettingsManager = CastSettingsManager.createCastSettingsManager( |
+ applicationContext, |
+ new CastSettingsManager.OnSettingChangedListener() { |
+ @Override |
+ public void onSendUsageStatsChanged(boolean enabled) { |
+ nativeSetSendUsageStatsEnabled(enabled); |
+ } |
+ }); |
+ } |
+ |
+ @CalledByNative |
+ public static boolean canSendUsageStats(Context context) { |
+ return sSettingsManager.isSendUsageStatsEnabled(); |
+ } |
+ |
+ private static native void nativeSetSendUsageStatsEnabled(boolean enabled); |
+} |