Chromium Code Reviews| 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 | |
|
Philippe
2013/04/22 11:35:48
Nit: s/listens/listen
| |
| 24 // changes in the android app state such as the app going to the background or | |
| 25 // foreground. | |
| 26 class SimpleCacheActivityStatusNotifier { | |
| 27 public: | |
| 28 // This enum must match the constants defined in | |
| 29 // ./base/android/java/src/org/chromium/base/ActivityStatus.java | |
| 30 enum ActivityStatus { | |
| 31 CREATED = 1, | |
| 32 STARTED = 2, | |
| 33 RESUMED = 3, | |
| 34 PAUSED = 4, | |
| 35 STOPPED = 5, | |
| 36 DESTROYED = 6 | |
| 37 }; | |
| 38 | |
| 39 typedef base::Callback<void(ActivityStatus activity_status)> | |
| 40 ActivityStatusChangedCallback; | |
|
Philippe
2013/04/22 11:35:48
Nit: this needs to be indented by 4 spaces. Altern
| |
| 41 | |
| 42 SimpleCacheActivityStatusNotifier( | |
| 43 base::SingleThreadTaskRunner* callback_runner, | |
|
Philippe
2013/04/22 11:35:48
Nit: input parameters go first.
| |
| 44 const ActivityStatusChangedCallback& notify_callback); | |
| 45 | |
| 46 ~SimpleCacheActivityStatusNotifier(); | |
| 47 | |
| 48 void NotifyActivityStatusChanged(JNIEnv* env, | |
| 49 jobject obj, | |
| 50 jint new_activity_status); | |
| 51 | |
| 52 static bool Register(JNIEnv* env); | |
| 53 | |
| 54 private: | |
|
Philippe
2013/04/22 11:35:48
Nit: this needs to be indented by 1 space (same on
| |
| 55 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
| 56 scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; | |
| 57 ActivityStatusChangedCallback notify_callback_; | |
| 58 | |
|
Philippe
2013/04/22 11:35:48
Nit: extra blank line.
| |
| 59 }; | |
| 60 | |
| 61 } // namespace net | |
|
Philippe
2013/04/22 11:35:48
Nit: a blank line should be added below.
| |
| 62 #endif // NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ | |
| OLD | NEW |