Chromium Code Reviews| Index: net/android/simple_cache_activity_status_notifier.h |
| diff --git a/net/android/simple_cache_activity_status_notifier.h b/net/android/simple_cache_activity_status_notifier.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..989f7a12a44b3ea5fbe527dc6b71fcb98b92f032 |
| --- /dev/null |
| +++ b/net/android/simple_cache_activity_status_notifier.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ |
| +#define NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ |
| + |
| +#include <jni.h> |
| + |
| +#include "base/android/jni_android.h" |
| +#include "base/basictypes.h" |
| +#include "base/callback.h" |
| +#include "base/memory/ref_counted.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace net { |
| + |
| +// This class is the native twin of the class with same name in |
| +// SimpleCacheActivityStatusNotifier.java |
| +// 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
|
| +// changes in the android app state such as the app going to the background or |
| +// foreground. |
| +class SimpleCacheActivityStatusNotifier { |
| +public: |
| + // This enum must match the constants defined in |
| + // ./base/android/java/src/org/chromium/base/ActivityStatus.java |
| + enum ActivityStatus { |
| + CREATED = 1, |
| + STARTED = 2, |
| + RESUMED = 3, |
| + PAUSED = 4, |
| + STOPPED = 5, |
| + DESTROYED = 6 |
| + }; |
| + |
| + typedef base::Callback<void(ActivityStatus activity_status)> |
| + ActivityStatusChangedCallback; |
|
Philippe
2013/04/22 11:35:48
Nit: this needs to be indented by 4 spaces. Altern
|
| + |
| + SimpleCacheActivityStatusNotifier( |
| + base::SingleThreadTaskRunner* callback_runner, |
|
Philippe
2013/04/22 11:35:48
Nit: input parameters go first.
|
| + const ActivityStatusChangedCallback& notify_callback); |
| + |
| + ~SimpleCacheActivityStatusNotifier(); |
| + |
| + void NotifyActivityStatusChanged(JNIEnv* env, |
| + jobject obj, |
| + jint new_activity_status); |
| + |
| + static bool Register(JNIEnv* env); |
| + |
| +private: |
|
Philippe
2013/04/22 11:35:48
Nit: this needs to be indented by 1 space (same on
|
| + base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| + scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; |
| + ActivityStatusChangedCallback notify_callback_; |
| + |
|
Philippe
2013/04/22 11:35:48
Nit: extra blank line.
|
| +}; |
| + |
| +} // namespace net |
|
Philippe
2013/04/22 11:35:48
Nit: a blank line should be added below.
|
| +#endif // NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ |