Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / android / precache / precache_launcher.h
bloba17821ad6763a1e1cc33dd2e807cd583c25011d8
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_
6 #define CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_
8 #include <jni.h>
10 #include "base/android/jni_android.h"
11 #include "base/android/jni_weak_ref.h"
12 #include "base/memory/weak_ptr.h"
14 class PrecacheLauncher {
15 public:
16 PrecacheLauncher(JNIEnv* env, jobject obj);
17 void Destroy(JNIEnv* env, jobject obj);
18 void Start(JNIEnv* env, jobject obj);
19 void Cancel(JNIEnv* env, jobject obj);
21 private:
22 ~PrecacheLauncher();
23 // Called when precaching completes. |try_again_soon| is true iff the precache
24 // failed to start due to a transient error and should be attempted again
25 // soon.
26 void OnPrecacheCompleted(bool try_again_soon);
28 JavaObjectWeakGlobalRef weak_java_precache_launcher_;
30 // This must be the last member field in the class.
31 base::WeakPtrFactory<PrecacheLauncher> weak_factory_;
33 DISALLOW_COPY_AND_ASSIGN(PrecacheLauncher);
36 // Registers the native methods to be called from Java.
37 bool RegisterPrecacheLauncher(JNIEnv* env);
39 #endif // CHROME_BROWSER_ANDROID_PRECACHE_PRECACHE_LAUNCHER_H_