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(); |
| 20 | |
gunsch | 168c44ce | 2014-10-09 04:37:06 | [diff] [blame] | 21 | // Returns whether or not the user has allowed sending usage stats and |
| 22 | // crash reports. |
| 23 | bool CanSendUsageStats(); |
| 24 | |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 25 | // Registers a handler to be notified when SendUsageStats is changed. |
| 26 | void SetSendUsageStatsChangedCallback( |
jameswest | 90b8e5b2 | 2017-06-07 23:31:42 | [diff] [blame] | 27 | base::RepeatingCallback<void(bool)> callback); |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 28 | |
jameswest | 90b8e5b2 | 2017-06-07 23:31:42 | [diff] [blame] | 29 | void RunSendUsageStatsChangedCallback(bool enabled); |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 30 | |
| 31 | private: |
scottmg | 5e65e3a | 2017-03-08 08:48:46 | [diff] [blame] | 32 | friend struct base::LazyInstanceTraitsBase<ChromecastConfigAndroid>; |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 33 | |
| 34 | ChromecastConfigAndroid(); |
| 35 | ~ChromecastConfigAndroid(); |
| 36 | |
jameswest | 90b8e5b2 | 2017-06-07 23:31:42 | [diff] [blame] | 37 | base::RepeatingCallback<void(bool)> send_usage_stats_changed_callback_; |
gunsch | 407189f | 2014-09-11 22:03:41 | [diff] [blame] | 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(ChromecastConfigAndroid); |
| 40 | }; |
| 41 | |
| 42 | } // namespace android |
| 43 | } // namespace chromecast |
| 44 | |
gunsch | 1863f66 | 2015-06-15 18:24:53 | [diff] [blame] | 45 | #endif // CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |