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" |
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/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/process.h" | 15 #include "base/process.h" |
16 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
17 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
18 #include "content/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
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 content { | 27 namespace content { |
28 class ContentViewClient; | |
29 class RenderWidgetHostViewAndroid; | 28 class RenderWidgetHostViewAndroid; |
30 | 29 |
31 // TODO(jrg): this is a shell. Upstream the rest. | 30 // TODO(jrg): this is a shell. Upstream the rest. |
32 class ContentViewCoreImpl : public ContentViewCore, | 31 class ContentViewCoreImpl : public ContentViewCore, |
33 public NotificationObserver { | 32 public NotificationObserver { |
34 public: | 33 public: |
35 ContentViewCoreImpl(JNIEnv* env, | 34 ContentViewCoreImpl(JNIEnv* env, |
36 jobject obj, | 35 jobject obj, |
37 bool hardware_accelerated, | 36 bool hardware_accelerated, |
38 bool take_ownership_of_web_contents, | 37 bool take_ownership_of_web_contents, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 jboolean CanGoBack(JNIEnv* env, jobject obj); | 108 jboolean CanGoBack(JNIEnv* env, jobject obj); |
110 jboolean CanGoForward(JNIEnv* env, jobject obj); | 109 jboolean CanGoForward(JNIEnv* env, jobject obj); |
111 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); | 110 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); |
112 void GoBack(JNIEnv* env, jobject obj); | 111 void GoBack(JNIEnv* env, jobject obj); |
113 void GoForward(JNIEnv* env, jobject obj); | 112 void GoForward(JNIEnv* env, jobject obj); |
114 void GoToOffset(JNIEnv* env, jobject obj, jint offset); | 113 void GoToOffset(JNIEnv* env, jobject obj, jint offset); |
115 void StopLoading(JNIEnv* env, jobject obj); | 114 void StopLoading(JNIEnv* env, jobject obj); |
116 void Reload(JNIEnv* env, jobject obj); | 115 void Reload(JNIEnv* env, jobject obj); |
117 jboolean NeedsReload(JNIEnv* env, jobject obj); | 116 jboolean NeedsReload(JNIEnv* env, jobject obj); |
118 void ClearHistory(JNIEnv* env, jobject obj); | 117 void ClearHistory(JNIEnv* env, jobject obj); |
119 void SetClient(JNIEnv* env, jobject obj, jobject jclient); | |
120 jint EvaluateJavaScript(JNIEnv* env, jobject obj, jstring script); | 118 jint EvaluateJavaScript(JNIEnv* env, jobject obj, jstring script); |
121 virtual int GetNativeImeAdapter(JNIEnv* env, jobject obj) OVERRIDE; | 119 virtual int GetNativeImeAdapter(JNIEnv* env, jobject obj) OVERRIDE; |
122 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; | 120 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; |
123 void AddJavascriptInterface(JNIEnv* env, | 121 void AddJavascriptInterface(JNIEnv* env, |
124 jobject obj, | 122 jobject obj, |
125 jobject object, | 123 jobject object, |
126 jstring name, | 124 jstring name, |
127 jboolean require_annotation); | 125 jboolean require_annotation); |
128 void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name); | 126 void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name); |
129 int GetNavigationHistory(JNIEnv* env, jobject obj, jobject context); | 127 int GetNavigationHistory(JNIEnv* env, jobject obj, jobject context); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // A weak reference to the Java ContentViewCore object. | 201 // A weak reference to the Java ContentViewCore object. |
204 JavaObjectWeakGlobalRef java_ref_; | 202 JavaObjectWeakGlobalRef java_ref_; |
205 | 203 |
206 NotificationRegistrar notification_registrar_; | 204 NotificationRegistrar notification_registrar_; |
207 | 205 |
208 // Reference to the current WebContents used to determine how and what to | 206 // Reference to the current WebContents used to determine how and what to |
209 // display in the ContentViewCore. | 207 // display in the ContentViewCore. |
210 WebContentsImpl* web_contents_; | 208 WebContentsImpl* web_contents_; |
211 bool owns_web_contents_; | 209 bool owns_web_contents_; |
212 | 210 |
213 // We only set this to be the delegate of the web_contents if we own it. | |
214 scoped_ptr<ContentViewClient> content_view_client_; | |
215 | |
216 // Whether the renderer backing this ContentViewCore has crashed. | 211 // Whether the renderer backing this ContentViewCore has crashed. |
217 bool tab_crashed_; | 212 bool tab_crashed_; |
218 | 213 |
219 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 214 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
220 }; | 215 }; |
221 | 216 |
222 bool RegisterContentViewCore(JNIEnv* env); | 217 bool RegisterContentViewCore(JNIEnv* env); |
223 | 218 |
224 } // namespace content | 219 } // namespace content |
225 | 220 |
226 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 221 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |