OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 14 class GURL; |
| 15 class Profile; |
| 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 namespace prerender { |
| 22 class PrerenderHandle; |
| 23 |
| 24 // A class for handling external prerender requests from other applications. |
| 25 class ExternalPrerenderHandlerAndroid { |
| 26 public: |
| 27 explicit ExternalPrerenderHandlerAndroid(); |
| 28 |
| 29 // Add a prerender with the given url and referrer on the PrerenderManager of |
| 30 // the given profile. This is restricted to a single prerender at a time. |
| 31 bool AddPrerender(JNIEnv* env, |
| 32 jobject obj, |
| 33 jobject profile, |
| 34 jint web_content_ptr, |
| 35 jstring url, |
| 36 jstring referrer, |
| 37 jint width, |
| 38 jint height); |
| 39 |
| 40 // Cancel the prerender associated with the prerender_handle_ |
| 41 void CancelCurrentPrerender(JNIEnv* env, jobject object); |
| 42 |
| 43 // Whether the PrerenderManager associated with the given profile has any |
| 44 // prerenders for the url. |
| 45 static bool HasPrerenderedUrl(Profile* profile, |
| 46 GURL url, |
| 47 content::WebContents* web_contents); |
| 48 |
| 49 static bool RegisterExternalPrerenderHandlerAndroid(JNIEnv* env); |
| 50 |
| 51 private: |
| 52 virtual ~ExternalPrerenderHandlerAndroid(); |
| 53 scoped_ptr<prerender::PrerenderHandle> prerender_handle_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ExternalPrerenderHandlerAndroid); |
| 56 }; |
| 57 |
| 58 } // namespace prerender |
| 59 |
| 60 #endif // CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_ |
OLD | NEW |