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

Unified Diff: chromecast/base/chromecast_config_android.cc

Issue 1180633002: Chromecast: don't try to upload crash immediately. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: address slan's comments Created 5 years, 6 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: chromecast/base/chromecast_config_android.cc
diff --git a/chromecast/android/chromecast_config_android.cc b/chromecast/base/chromecast_config_android.cc
similarity index 54%
rename from chromecast/android/chromecast_config_android.cc
rename to chromecast/base/chromecast_config_android.cc
index d698b70a18b8b16ef3336c80bc21e38a98c045a1..7e09dec0d3e7615189a1607ba7f4d974d99902b3 100644
--- a/chromecast/android/chromecast_config_android.cc
+++ b/chromecast/base/chromecast_config_android.cc
@@ -2,7 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chromecast/android/chromecast_config_android.h"
+#include "chromecast/base/chromecast_config_android.h"
+
+#include "base/android/jni_android.h"
+#include "base/lazy_instance.h"
+#include "jni/ChromecastConfigAndroid_jni.h"
namespace chromecast {
namespace android {
@@ -17,17 +21,34 @@ ChromecastConfigAndroid* ChromecastConfigAndroid::GetInstance() {
return g_instance.Pointer();
}
+// static
+bool ChromecastConfigAndroid::RegisterJni(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
ChromecastConfigAndroid::ChromecastConfigAndroid() {
}
ChromecastConfigAndroid::~ChromecastConfigAndroid() {
}
+bool ChromecastConfigAndroid::CanSendUsageStats() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ return Java_ChromecastConfigAndroid_canSendUsageStats(
+ env, base::android::GetApplicationContext());
+}
+
// Registers a handler to be notified when SendUsageStats is changed.
void ChromecastConfigAndroid::SetSendUsageStatsChangedCallback(
const base::Callback<void(bool)>& callback) {
send_usage_stats_changed_callback_ = callback;
}
+// Called from Java.
+void SetSendUsageStatsEnabled(JNIEnv* env, jclass caller, jboolean enabled) {
+ ChromecastConfigAndroid::GetInstance()->
byungchul 2015/06/11 17:15:00 Why is ChromecastConfigAndroid static in Java and
gunsch 2015/06/12 00:30:30 We could probably simplify this code more if we up
byungchul 2015/06/12 05:57:00 Right, we should use chromecast preference for ATV
gunsch 2015/06/12 16:54:52 Done. (will upload after addressing other comments
+ send_usage_stats_changed_callback().Run(enabled);
+}
+
} // namespace android
} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698