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 CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ |
6 #define CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ | 6 #define CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 | 13 |
14 class PrecacheLauncher { | 14 class PrecacheLauncher { |
15 public: | 15 public: |
16 PrecacheLauncher(JNIEnv* env, jobject obj); | 16 PrecacheLauncher(JNIEnv* env, jobject obj); |
17 void Destroy(JNIEnv* env, jobject obj); | 17 void Destroy(JNIEnv* env, jobject obj); |
18 void Start(JNIEnv* env, jobject obj); | 18 void Start(JNIEnv* env, jobject obj); |
19 void Cancel(JNIEnv* env, jobject obj); | 19 void Cancel(JNIEnv* env, jobject obj); |
20 | 20 |
21 private: | 21 private: |
22 ~PrecacheLauncher(); | 22 ~PrecacheLauncher(); |
23 // Called when precaching completes. | 23 // Called when precaching completes. |precache_started| is true iff the |
24 void OnPrecacheCompleted(); | 24 // preconditions were met and the precache started successfully. |
| 25 void OnPrecacheCompleted(bool precache_started); |
25 | 26 |
26 JavaObjectWeakGlobalRef weak_java_precache_launcher_; | 27 JavaObjectWeakGlobalRef weak_java_precache_launcher_; |
27 | 28 |
28 // This must be the last member field in the class. | 29 // This must be the last member field in the class. |
29 base::WeakPtrFactory<PrecacheLauncher> weak_factory_; | 30 base::WeakPtrFactory<PrecacheLauncher> weak_factory_; |
30 | 31 |
31 DISALLOW_COPY_AND_ASSIGN(PrecacheLauncher); | 32 DISALLOW_COPY_AND_ASSIGN(PrecacheLauncher); |
32 }; | 33 }; |
33 | 34 |
34 // Registers the native methods to be called from Java. | 35 // Registers the native methods to be called from Java. |
35 bool RegisterPrecacheLauncher(JNIEnv* env); | 36 bool RegisterPrecacheLauncher(JNIEnv* env); |
36 | 37 |
37 #endif // CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ | 38 #endif // CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_ |
OLD | NEW |