| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMECAST_ANDROID_CHROMECAST_CONFIG_ANDROID_H_ | 5 #ifndef CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |
| 6 #define CHROMECAST_ANDROID_CHROMECAST_CONFIG_ANDROID_H_ | 6 #define CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 | 13 |
| 14 namespace chromecast { | 14 namespace chromecast { |
| 15 namespace android { | 15 namespace android { |
| 16 | 16 |
| 17 class ChromecastConfigAndroid { | 17 class ChromecastConfigAndroid { |
| 18 public: | 18 public: |
| 19 static ChromecastConfigAndroid* GetInstance(); | 19 static ChromecastConfigAndroid* GetInstance(); |
| 20 static bool RegisterJni(JNIEnv* env); |
| 20 | 21 |
| 21 // Returns whether or not the user has allowed sending usage stats and | 22 // Returns whether or not the user has allowed sending usage stats and |
| 22 // crash reports. | 23 // crash reports. |
| 23 bool CanSendUsageStats(); | 24 bool CanSendUsageStats(); |
| 24 | 25 |
| 25 // Registers a handler to be notified when SendUsageStats is changed. | 26 // Registers a handler to be notified when SendUsageStats is changed. |
| 26 void SetSendUsageStatsChangedCallback( | 27 void SetSendUsageStatsChangedCallback( |
| 27 const base::Callback<void(bool)>& callback); | 28 const base::Callback<void(bool)>& callback); |
| 28 | 29 |
| 29 const base::Callback<void(bool)>& send_usage_stats_changed_callback() const { | 30 const base::Callback<void(bool)>& send_usage_stats_changed_callback() const { |
| 30 return send_usage_stats_changed_callback_; | 31 return send_usage_stats_changed_callback_; |
| 31 } | 32 } |
| 32 | 33 |
| 33 private: | 34 private: |
| 34 friend struct base::DefaultLazyInstanceTraits<ChromecastConfigAndroid>; | 35 friend struct base::DefaultLazyInstanceTraits<ChromecastConfigAndroid>; |
| 35 | 36 |
| 36 ChromecastConfigAndroid(); | 37 ChromecastConfigAndroid(); |
| 37 ~ChromecastConfigAndroid(); | 38 ~ChromecastConfigAndroid(); |
| 38 | 39 |
| 39 base::Callback<void(bool)> send_usage_stats_changed_callback_; | 40 base::Callback<void(bool)> send_usage_stats_changed_callback_; |
| 40 | 41 |
| 41 DISALLOW_COPY_AND_ASSIGN(ChromecastConfigAndroid); | 42 DISALLOW_COPY_AND_ASSIGN(ChromecastConfigAndroid); |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 } // namespace android | 45 } // namespace android |
| 45 } // namespace chromecast | 46 } // namespace chromecast |
| 46 | 47 |
| 47 #endif // CHROMECAST_ANDROID_CHROMECAST_CONFIG_ANDROID_H_ | 48 #endif // CHROMECAST_BASE_CHROMECAST_CONFIG_ANDROID_H_ |
| OLD | NEW |