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

Side by Side 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: rebase 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromecast/base/chromecast_config_android.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/lazy_instance.h"
9 #include "jni/ChromecastConfigAndroid_jni.h"
10
11 namespace chromecast {
12 namespace android {
13
14 namespace {
15 base::LazyInstance<ChromecastConfigAndroid> g_instance =
16 LAZY_INSTANCE_INITIALIZER;
17 } // namespace
18
19 // static
20 ChromecastConfigAndroid* ChromecastConfigAndroid::GetInstance() {
21 return g_instance.Pointer();
22 }
23
24 // static
25 bool ChromecastConfigAndroid::RegisterJni(JNIEnv* env) {
26 return RegisterNativesImpl(env);
27 }
28
29 ChromecastConfigAndroid::ChromecastConfigAndroid() {
30 }
31
32 ChromecastConfigAndroid::~ChromecastConfigAndroid() {
33 }
34
35 bool ChromecastConfigAndroid::CanSendUsageStats() {
36 // TODO(gunsch): make opt-in.stats pref the source of truth for this data,
37 // instead of Android prefs, then delete ChromecastConfigAndroid.
38 JNIEnv* env = base::android::AttachCurrentThread();
39 return Java_ChromecastConfigAndroid_canSendUsageStats(
40 env, base::android::GetApplicationContext());
41 }
42
43 // Registers a handler to be notified when SendUsageStats is changed.
44 void ChromecastConfigAndroid::SetSendUsageStatsChangedCallback(
45 const base::Callback<void(bool)>& callback) {
46 send_usage_stats_changed_callback_ = callback;
47 }
48
49 // Called from Java.
50 void SetSendUsageStatsEnabled(JNIEnv* env, jclass caller, jboolean enabled) {
51 ChromecastConfigAndroid::GetInstance()->
52 send_usage_stats_changed_callback().Run(enabled);
53 }
54
55 } // namespace android
56 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698