Chromium Code Reviews| Index: chrome/browser/predictors/resource_prefetch_predictor_android.h |
| diff --git a/chrome/browser/predictors/resource_prefetch_predictor_android.h b/chrome/browser/predictors/resource_prefetch_predictor_android.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b26e983f2a210be5e508c7ae859427db88b6169a |
| --- /dev/null |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor_android.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 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 CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_ANDROID_H_ |
| +#define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_ANDROID_H_ |
| + |
| +#include <jni.h> |
| + |
| +#include "base/macros.h" |
| + |
| +namespace base { |
| +namespace android { |
| +template <typename T> |
| +class JavaParamRef; |
| +} // namespace android |
| +} // namespace base |
| + |
| +namespace predictors { |
| + |
| +class ResourcePrefetchPredictor; |
| + |
| +class ResourcePrefetchPredictorAndroid { |
| + public: |
| + // See ResourcePrefetchPredictor::StartPrefetching(). |
| + void StartPrefetching(JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& jcaller, |
| + const base::android::JavaParamRef<jstring>& j_url); |
| + // See ResourcePrefetchPredictor::StopPrefetching(). |
| + void StopPrefetching(JNIEnv* env, |
| + const base::android::JavaParamRef<jobject>& jcaller, |
| + const base::android::JavaParamRef<jstring>& j_url); |
| + |
| + // Returns a pointer to a new instance of |ResourePrefetchPredictorAndroid|, |
| + // for a given profile. |
| + static jlong GetForProfile(JNIEnv* env, jclass clazz, jobject j_profile); |
| + static bool Register(JNIEnv* env); |
| + |
| + private: |
| + explicit ResourcePrefetchPredictorAndroid( |
| + ResourcePrefetchPredictor* predictor); |
| + |
| + ResourcePrefetchPredictor* predictor_; |
|
pasko
2016/09/27 16:54:31
What if ResourcePrefetchPredictor is destroyed? Sh
Benoit L
2016/09/28 12:15:25
Changed to have the object hold a pointer to the p
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictorAndroid); |
| +}; |
| + |
| +} // namespace predictors |
| + |
| +#endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_ANDROID_H_ |