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 CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_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/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
14 #include "content/browser/frame_host/navigation_controller_android.h" | 14 #include "content/browser/frame_host/navigation_controller_android.h" |
15 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 15 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 16 #include "content/browser/transition_request_manager.h" |
16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class WebContents; | 21 class WebContents; |
| 22 struct TransitionLayerData; |
21 | 23 |
22 // Android wrapper around WebContents that provides safer passage from java and | 24 // Android wrapper around WebContents that provides safer passage from java and |
23 // back to native and provides java with a means of communicating with its | 25 // back to native and provides java with a means of communicating with its |
24 // native counterpart. | 26 // native counterpart. |
25 class CONTENT_EXPORT WebContentsAndroid | 27 class CONTENT_EXPORT WebContentsAndroid |
26 : public base::SupportsUserData::Data { | 28 : public base::SupportsUserData::Data { |
27 public: | 29 public: |
28 static bool Register(JNIEnv* env); | 30 static bool Register(JNIEnv* env); |
29 | 31 |
30 explicit WebContentsAndroid(WebContents* web_contents); | 32 explicit WebContentsAndroid(WebContents* web_contents); |
31 virtual ~WebContentsAndroid(); | 33 virtual ~WebContentsAndroid(); |
32 | 34 |
33 WebContents* web_contents() const { return web_contents_; } | 35 WebContents* web_contents() const { return web_contents_; } |
34 | 36 |
35 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | 37 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
36 | 38 |
37 // Methods called from Java | 39 // Methods called from Java |
38 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, | 40 base::android::ScopedJavaLocalRef<jstring> GetTitle(JNIEnv* env, |
39 jobject obj) const; | 41 jobject obj) const; |
40 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, | 42 base::android::ScopedJavaLocalRef<jstring> GetVisibleURL(JNIEnv* env, |
41 jobject obj) const; | 43 jobject obj) const; |
42 void Stop(JNIEnv* env, jobject obj); | 44 void Stop(JNIEnv* env, jobject obj); |
43 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 45 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
| 46 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; |
| 47 jboolean IsIncognito(JNIEnv* env, jobject obj); |
| 48 |
| 49 void ResumeResponseDeferredAtStart(JNIEnv* env, jobject obj); |
| 50 void SetHasPendingNavigationTransitionForTesting(JNIEnv* env, jobject obj); |
| 51 void SetupTransitionView(JNIEnv* env, jobject jobj, jstring markup); |
| 52 void BeginExitTransition(JNIEnv* env, jobject jobj, jstring css_selector); |
| 53 |
| 54 // This method is invoked when the request is deferred immediately after |
| 55 // receiving response headers. |
| 56 void DidDeferAfterResponseStarted(const TransitionLayerData& transition_data); |
| 57 |
| 58 // This method is invoked when a navigation transition is detected, to |
| 59 // determine if the embedder intends to handle it. |
| 60 bool WillHandleDeferAfterResponseStarted(); |
| 61 |
| 62 // This method is invoked when a navigation transition has started. |
| 63 void DidStartNavigationTransitionForFrame(int64 frame_id); |
| 64 |
44 void OnHide(JNIEnv* env, jobject obj); | 65 void OnHide(JNIEnv* env, jobject obj); |
45 void OnShow(JNIEnv* env, jobject obj); | 66 void OnShow(JNIEnv* env, jobject obj); |
46 void PauseVideo(); | 67 void PauseVideo(); |
47 void AddStyleSheetByURL( | 68 void AddStyleSheetByURL( |
48 JNIEnv* env, jobject obj, jstring url); | 69 JNIEnv* env, jobject obj, jstring url); |
49 void ShowInterstitialPage( | 70 void ShowInterstitialPage( |
50 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); | 71 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); |
51 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); | 72 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); |
52 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); | 73 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); |
53 void ExitFullscreen(JNIEnv* env, jobject obj); | 74 void ExitFullscreen(JNIEnv* env, jobject obj); |
(...skipping 15 matching lines...) Expand all Loading... |
69 WebContents* web_contents_; | 90 WebContents* web_contents_; |
70 NavigationControllerAndroid navigation_controller_; | 91 NavigationControllerAndroid navigation_controller_; |
71 base::android::ScopedJavaGlobalRef<jobject> obj_; | 92 base::android::ScopedJavaGlobalRef<jobject> obj_; |
72 | 93 |
73 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 94 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
74 }; | 95 }; |
75 | 96 |
76 } // namespace content | 97 } // namespace content |
77 | 98 |
78 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 99 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
OLD | NEW |