Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / prerender / external_prerender_handler_android.h
blob111181c46edba420a276b442c86530a16c2530a0
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.
5 #ifndef CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_
6 #define CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/memory/scoped_ptr.h"
13 class GURL;
14 class Profile;
16 namespace content {
17 class WebContents;
20 namespace prerender {
21 class PrerenderHandle;
23 // A class for handling external prerender requests from other applications.
24 class ExternalPrerenderHandlerAndroid {
25 public:
26 explicit ExternalPrerenderHandlerAndroid();
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.
30 bool AddPrerender(JNIEnv* env,
31 jobject obj,
32 jobject profile,
33 jlong web_content_ptr,
34 jstring url,
35 jstring referrer,
36 jint width,
37 jint height);
39 // Cancel the prerender associated with the prerender_handle_
40 void CancelCurrentPrerender(JNIEnv* env, jobject object);
42 // Whether the PrerenderManager associated with the given profile has any
43 // prerenders for the url.
44 static bool HasPrerenderedUrl(Profile* profile,
45 GURL url,
46 content::WebContents* web_contents);
48 static bool RegisterExternalPrerenderHandlerAndroid(JNIEnv* env);
50 private:
51 virtual ~ExternalPrerenderHandlerAndroid();
52 scoped_ptr<prerender::PrerenderHandle> prerender_handle_;
54 DISALLOW_COPY_AND_ASSIGN(ExternalPrerenderHandlerAndroid);
57 } // namespace prerender
59 #endif // CHROME_BROWSER_PRERENDER_EXTERNAL_PRERENDER_HANDLER_ANDROID_H_