gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 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 | |
gunsch | 1863f66 | 2015-06-15 18:24:53 | [diff] [blame] | 5 | #ifndef CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |
| 6 | #define CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 7 | |
| 8 | #include <jni.h> |
| 9 | |
| 10 | #include "base/callback.h" |
| 11 | #include "base/lazy_instance.h" |
| 12 | #include "base/macros.h" |
| 13 | |
| 14 | namespace chromecast { |
| 15 | namespace android { |
| 16 | |
| 17 | class ChromecastConfigAndroid { |
| 18 | public: |
| 19 | static ChromecastConfigAndroid* GetInstance(); |
gunsch | 1863f66 | 2015-06-15 18:24:53 | [diff] [blame] | 20 | static bool RegisterJni(JNIEnv* env); |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 21 | |
gunsch | 168c44ce | 2014-10-09 04:37:06 | [diff] [blame] | 22 | // Returns whether or not the user has allowed sending usage stats and |
| 23 | // crash reports. |
| 24 | bool CanSendUsageStats(); |
| 25 | |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 26 | // Registers a handler to be notified when SendUsageStats is changed. |
| 27 | void SetSendUsageStatsChangedCallback( |
| 28 | const base::Callback<void(bool)>& callback); |
| 29 | |
| 30 | const base::Callback<void(bool)>& send_usage_stats_changed_callback() const { |
| 31 | return send_usage_stats_changed_callback_; |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | friend struct base::DefaultLazyInstanceTraits<ChromecastConfigAndroid>; |
| 36 | |
| 37 | ChromecastConfigAndroid(); |
| 38 | ~ChromecastConfigAndroid(); |
| 39 | |
| 40 | base::Callback<void(bool)> send_usage_stats_changed_callback_; |
| 41 | |
| 42 | DISALLOW_COPY_AND_ASSIGN(ChromecastConfigAndroid); |
| 43 | }; |
| 44 | |
| 45 | } // namespace android |
| 46 | } // namespace chromecast |
| 47 | |
gunsch | 1863f66 | 2015-06-15 18:24:53 | [diff] [blame] | 48 | #endif // CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |