OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 | 24 |
25 struct WebMenuItem; | 25 struct WebMenuItem; |
26 | 26 |
27 namespace ui { | 27 namespace ui { |
28 class WindowAndroid; | 28 class WindowAndroid; |
29 } | 29 } |
30 | 30 |
31 namespace content { | 31 namespace content { |
| 32 class ContentViewClient; |
32 class RenderWidgetHostViewAndroid; | 33 class RenderWidgetHostViewAndroid; |
33 | 34 |
34 // TODO(jrg): this is a shell. Upstream the rest. | 35 // TODO(jrg): this is a shell. Upstream the rest. |
35 class ContentViewCoreImpl : public ContentViewCore, | 36 class ContentViewCoreImpl : public ContentViewCore, |
36 public NotificationObserver { | 37 public NotificationObserver { |
37 public: | 38 public: |
38 ContentViewCoreImpl(JNIEnv* env, | 39 ContentViewCoreImpl(JNIEnv* env, |
39 jobject obj, | 40 jobject obj, |
40 bool hardware_accelerated, | 41 bool hardware_accelerated, |
41 WebContents* web_contents, | 42 WebContents* web_contents, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 jboolean CanGoBack(JNIEnv* env, jobject obj); | 117 jboolean CanGoBack(JNIEnv* env, jobject obj); |
117 jboolean CanGoForward(JNIEnv* env, jobject obj); | 118 jboolean CanGoForward(JNIEnv* env, jobject obj); |
118 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); | 119 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); |
119 void GoBack(JNIEnv* env, jobject obj); | 120 void GoBack(JNIEnv* env, jobject obj); |
120 void GoForward(JNIEnv* env, jobject obj); | 121 void GoForward(JNIEnv* env, jobject obj); |
121 void GoToOffset(JNIEnv* env, jobject obj, jint offset); | 122 void GoToOffset(JNIEnv* env, jobject obj, jint offset); |
122 void StopLoading(JNIEnv* env, jobject obj); | 123 void StopLoading(JNIEnv* env, jobject obj); |
123 void Reload(JNIEnv* env, jobject obj); | 124 void Reload(JNIEnv* env, jobject obj); |
124 jboolean NeedsReload(JNIEnv* env, jobject obj); | 125 jboolean NeedsReload(JNIEnv* env, jobject obj); |
125 void ClearHistory(JNIEnv* env, jobject obj); | 126 void ClearHistory(JNIEnv* env, jobject obj); |
| 127 void SetClient(JNIEnv* env, jobject obj, jobject jclient); |
126 jint EvaluateJavaScript(JNIEnv* env, jobject obj, jstring script); | 128 jint EvaluateJavaScript(JNIEnv* env, jobject obj, jstring script); |
127 int GetNativeImeAdapter(JNIEnv* env, jobject obj); | 129 int GetNativeImeAdapter(JNIEnv* env, jobject obj); |
128 void AddJavascriptInterface(JNIEnv* env, | 130 void AddJavascriptInterface(JNIEnv* env, |
129 jobject obj, | 131 jobject obj, |
130 jobject object, | 132 jobject object, |
131 jstring name, | 133 jstring name, |
132 jboolean require_annotation); | 134 jboolean require_annotation); |
133 void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name); | 135 void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name); |
134 int GetNavigationHistory(JNIEnv* env, jobject obj, jobject context); | 136 int GetNavigationHistory(JNIEnv* env, jobject obj, jobject context); |
135 | 137 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 207 |
206 // A weak reference to the Java ContentViewCore object. | 208 // A weak reference to the Java ContentViewCore object. |
207 JavaObjectWeakGlobalRef java_ref_; | 209 JavaObjectWeakGlobalRef java_ref_; |
208 | 210 |
209 NotificationRegistrar notification_registrar_; | 211 NotificationRegistrar notification_registrar_; |
210 | 212 |
211 // Reference to the current WebContents used to determine how and what to | 213 // Reference to the current WebContents used to determine how and what to |
212 // display in the ContentViewCore. | 214 // display in the ContentViewCore. |
213 WebContentsImpl* web_contents_; | 215 WebContentsImpl* web_contents_; |
214 | 216 |
| 217 // We only set this to be the delegate of the web_contents if we own it. |
| 218 scoped_ptr<ContentViewClient> content_view_client_; |
| 219 |
215 // Whether the renderer backing this ContentViewCore has crashed. | 220 // Whether the renderer backing this ContentViewCore has crashed. |
216 bool tab_crashed_; | 221 bool tab_crashed_; |
217 | 222 |
218 // The owning window that has a hold of main application activity. | 223 // The owning window that has a hold of main application activity. |
219 ui::WindowAndroid* window_android_; | 224 ui::WindowAndroid* window_android_; |
220 | 225 |
221 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 226 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
222 }; | 227 }; |
223 | 228 |
224 bool RegisterContentViewCore(JNIEnv* env); | 229 bool RegisterContentViewCore(JNIEnv* env); |
225 | 230 |
226 } // namespace content | 231 } // namespace content |
227 | 232 |
228 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 233 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |