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..33c5947d6d81b9b117226734ace111c81004ebab |
--- /dev/null |
+++ b/net/android/simple_cache_activity_status_notifier.h |
@@ -0,0 +1,51 @@ |
+// 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 |
+// changes in the android app state such as the app going to the background or |
+// foreground. |
+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
|
+public: |
+ typedef base::Callback<void(int activity_status)> |
+ ActivityStatusChangedCallback; |
+ |
+ SimpleCacheActivityStatusNotifier( |
+ base::SingleThreadTaskRunner* callback_runner, |
+ const ActivityStatusChangedCallback& notify_callback); |
+ |
+ ~SimpleCacheActivityStatusNotifier(); |
+ |
+ void NotifyActivityStatusChanged(JNIEnv* env, |
+ jobject obj, |
+ jint new_activity_status); |
+ |
+ static bool Register(JNIEnv* env); |
+ |
+private: |
+ base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
+ scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; |
+ ActivityStatusChangedCallback notify_callback_; |
+ |
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
|
+}; |
+ |
+} // namespace net |
+#endif // NET_ANDROID_SIMPLE_CACHE_ACTIVITY_STATUS_NOTIFIER_H_ |