OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 #ifndef NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ | |
6 #define NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include "base/android/jni_android.h" | |
11 #include "base/basictypes.h" | |
12 #include "base/callback.h" | |
13 #include "base/memory/ref_counted.h" | |
14 | |
15 namespace base { | |
16 class SingleThreadTaskRunner; | |
17 } | |
18 | |
19 namespace net { | |
20 | |
21 // This class is the native twin of the class with same name in | |
22 // SimpleCacheActivityStatusNotifier.java | |
23 // This is used by the SimpleIndex in net/disk_cache/simple/ to listens to | |
24 // changes in the android app state such as the app going to the background or | |
25 // foreground. | |
26 class SimpleCacheActivityStatusNotifier { | |
gavinp
2013/04/19 15:58:55
#if defined(OS_ANDROID)
felipeg
2013/04/19 17:13:32
This file is only used on android anyway.
It makes
| |
27 public: | |
28 typedef base::Callback<void(int activity_status)> | |
29 ActivityStatusChangedCallback; | |
30 | |
31 SimpleCacheActivityStatusNotifier( | |
32 base::SingleThreadTaskRunner* callback_runner, | |
33 const ActivityStatusChangedCallback& notify_callback); | |
34 | |
35 ~SimpleCacheActivityStatusNotifier(); | |
36 | |
37 void NotifyActivityStatusChanged(JNIEnv* env, | |
38 jobject obj, | |
39 jint new_activity_status); | |
40 | |
41 static bool Register(JNIEnv* env); | |
42 | |
43 private: | |
44 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
45 scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; | |
46 ActivityStatusChangedCallback notify_callback_; | |
47 | |
gavinp
2013/04/19 15:58:55
#endif // defined(OS_ANDROID)
(and probably the
felipeg
2013/04/19 17:13:32
AFAICT this is not how it is done on android.
I up
| |
48 }; | |
49 | |
50 } // namespace net | |
51 #endif // NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ | |
OLD | NEW |