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