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/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/browser/frame_host/navigation_controller_android.h" | 16 #include "content/browser/frame_host/navigation_controller_android.h" |
17 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
18 #include "content/browser/transition_request_manager.h" | |
19 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 | 21 |
23 class WebContents; | 22 class WebContents; |
24 struct TransitionLayerData; | |
25 | 23 |
26 // Android wrapper around WebContents that provides safer passage from java and | 24 // Android wrapper around WebContents that provides safer passage from java and |
27 // 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 |
28 // native counterpart. | 26 // native counterpart. |
29 class CONTENT_EXPORT WebContentsAndroid | 27 class CONTENT_EXPORT WebContentsAndroid |
30 : public base::SupportsUserData::Data { | 28 : public base::SupportsUserData::Data { |
31 public: | 29 public: |
32 static bool Register(JNIEnv* env); | 30 static bool Register(JNIEnv* env); |
33 | 31 |
34 explicit WebContentsAndroid(WebContents* web_contents); | 32 explicit WebContentsAndroid(WebContents* web_contents); |
(...skipping 12 matching lines...) Expand all Loading... |
47 bool IsLoading(JNIEnv* env, jobject obj) const; | 45 bool IsLoading(JNIEnv* env, jobject obj) const; |
48 bool IsLoadingToDifferentDocument(JNIEnv* env, jobject obj) const; | 46 bool IsLoadingToDifferentDocument(JNIEnv* env, jobject obj) const; |
49 | 47 |
50 void Stop(JNIEnv* env, jobject obj); | 48 void Stop(JNIEnv* env, jobject obj); |
51 jint GetBackgroundColor(JNIEnv* env, jobject obj); | 49 jint GetBackgroundColor(JNIEnv* env, jobject obj); |
52 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; | 50 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; |
53 base::android::ScopedJavaLocalRef<jstring> GetLastCommittedURL(JNIEnv* env, | 51 base::android::ScopedJavaLocalRef<jstring> GetLastCommittedURL(JNIEnv* env, |
54 jobject) const; | 52 jobject) const; |
55 jboolean IsIncognito(JNIEnv* env, jobject obj); | 53 jboolean IsIncognito(JNIEnv* env, jobject obj); |
56 | 54 |
57 void ResumeResponseDeferredAtStart(JNIEnv* env, jobject obj); | |
58 void ResumeLoadingCreatedWebContents(JNIEnv* env, jobject obj); | 55 void ResumeLoadingCreatedWebContents(JNIEnv* env, jobject obj); |
59 void SetHasPendingNavigationTransitionForTesting(JNIEnv* env, jobject obj); | |
60 void SetupTransitionView(JNIEnv* env, jobject jobj, jstring markup); | |
61 void BeginExitTransition(JNIEnv* env, jobject jobj, jstring css_selector, | |
62 jboolean exit_to_native_app); | |
63 void RevertExitTransition(JNIEnv* env, jobject jobj); | |
64 void HideTransitionElements(JNIEnv* env, jobject jobj, jstring css_selector); | |
65 void ShowTransitionElements(JNIEnv* env, jobject jobj, jstring css_selector); | |
66 void ClearNavigationTransitionData(JNIEnv* env, jobject jobj); | |
67 void FetchTransitionElements(JNIEnv* env, jobject jobj, jstring jurl); | |
68 void OnTransitionElementsFetched( | |
69 scoped_ptr<const TransitionLayerData> transition_data, | |
70 bool has_transition_data); | |
71 | |
72 // This method is invoked when the request is deferred immediately after | |
73 // receiving response headers. | |
74 void DidDeferAfterResponseStarted(const TransitionLayerData& transition_data); | |
75 | |
76 // This method is invoked when a navigation transition is detected, to | |
77 // determine if the embedder intends to handle it. | |
78 bool WillHandleDeferAfterResponseStarted(); | |
79 | |
80 // This method is invoked when a navigation transition has started. | |
81 void DidStartNavigationTransitionForFrame(int64 frame_id); | |
82 | 56 |
83 void OnHide(JNIEnv* env, jobject obj); | 57 void OnHide(JNIEnv* env, jobject obj); |
84 void OnShow(JNIEnv* env, jobject obj); | 58 void OnShow(JNIEnv* env, jobject obj); |
85 void ReleaseMediaPlayers(JNIEnv* env, jobject jobj); | 59 void ReleaseMediaPlayers(JNIEnv* env, jobject jobj); |
86 | 60 |
87 void AddStyleSheetByURL( | |
88 JNIEnv* env, jobject obj, jstring url); | |
89 void ShowInterstitialPage( | 61 void ShowInterstitialPage( |
90 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); | 62 JNIEnv* env, jobject obj, jstring jurl, jlong delegate_ptr); |
91 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); | 63 jboolean IsShowingInterstitialPage(JNIEnv* env, jobject obj); |
92 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); | 64 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); |
93 void ExitFullscreen(JNIEnv* env, jobject obj); | 65 void ExitFullscreen(JNIEnv* env, jobject obj); |
94 void UpdateTopControlsState( | 66 void UpdateTopControlsState( |
95 JNIEnv* env, | 67 JNIEnv* env, |
96 jobject obj, | 68 jobject obj, |
97 bool enable_hiding, | 69 bool enable_hiding, |
98 bool enable_showing, | 70 bool enable_showing, |
(...skipping 28 matching lines...) Expand all Loading... |
127 base::android::ScopedJavaGlobalRef<jobject> obj_; | 99 base::android::ScopedJavaGlobalRef<jobject> obj_; |
128 | 100 |
129 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; | 101 base::WeakPtrFactory<WebContentsAndroid> weak_factory_; |
130 | 102 |
131 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); | 103 DISALLOW_COPY_AND_ASSIGN(WebContentsAndroid); |
132 }; | 104 }; |
133 | 105 |
134 } // namespace content | 106 } // namespace content |
135 | 107 |
136 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ | 108 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_ANDROID_H_ |
OLD | NEW |