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/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
22 | 23 |
23 struct WebMenuItem; | 24 struct WebMenuItem; |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 class ContentViewClient; | 27 class ContentViewClient; |
27 class RenderWidgetHostViewAndroid; | 28 class RenderWidgetHostViewAndroid; |
28 | 29 |
29 // TODO(jrg): this is a shell. Upstream the rest. | 30 // TODO(jrg): this is a shell. Upstream the rest. |
30 class ContentViewCoreImpl : public ContentViewCore, | 31 class ContentViewCoreImpl : public ContentViewCore, |
31 public NotificationObserver { | 32 public NotificationObserver { |
32 public: | 33 public: |
33 ContentViewCoreImpl(JNIEnv* env, | 34 ContentViewCoreImpl(JNIEnv* env, |
34 jobject obj, | 35 jobject obj, |
35 WebContents* web_contents); | 36 WebContents* web_contents); |
| 37 |
| 38 // ContentViewCore overrides |
36 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; | 39 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; |
37 | 40 |
38 // -------------------------------------------------------------------------- | 41 // -------------------------------------------------------------------------- |
39 // Methods called from Java via JNI | 42 // Methods called from Java via JNI |
40 // -------------------------------------------------------------------------- | 43 // -------------------------------------------------------------------------- |
41 | 44 |
42 // Notifies the ContentViewCore that items were selected in the currently | 45 // Notifies the ContentViewCore that items were selected in the currently |
43 // showing select popup. | 46 // showing select popup. |
44 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); | 47 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); |
45 | 48 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); | 104 jboolean CanGoToOffset(JNIEnv* env, jobject obj, jint offset); |
102 void GoBack(JNIEnv* env, jobject obj); | 105 void GoBack(JNIEnv* env, jobject obj); |
103 void GoForward(JNIEnv* env, jobject obj); | 106 void GoForward(JNIEnv* env, jobject obj); |
104 void GoToOffset(JNIEnv* env, jobject obj, jint offset); | 107 void GoToOffset(JNIEnv* env, jobject obj, jint offset); |
105 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const; | 108 jdouble GetLoadProgress(JNIEnv* env, jobject obj) const; |
106 void StopLoading(JNIEnv* env, jobject obj); | 109 void StopLoading(JNIEnv* env, jobject obj); |
107 void Reload(JNIEnv* env, jobject obj); | 110 void Reload(JNIEnv* env, jobject obj); |
108 jboolean NeedsReload(JNIEnv* env, jobject obj); | 111 jboolean NeedsReload(JNIEnv* env, jobject obj); |
109 void ClearHistory(JNIEnv* env, jobject obj); | 112 void ClearHistory(JNIEnv* env, jobject obj); |
110 void SetClient(JNIEnv* env, jobject obj, jobject jclient); | 113 void SetClient(JNIEnv* env, jobject obj, jobject jclient); |
| 114 void AddJavascriptInterface(JNIEnv* env, |
| 115 jobject obj, |
| 116 jobject object, |
| 117 jstring name, |
| 118 jboolean allow_inherited_methods); |
| 119 void RemoveJavascriptInterface(JNIEnv* env, jobject obj, jstring name); |
111 | 120 |
112 // -------------------------------------------------------------------------- | 121 // -------------------------------------------------------------------------- |
113 // Public methods that call to Java via JNI | 122 // Public methods that call to Java via JNI |
114 // -------------------------------------------------------------------------- | 123 // -------------------------------------------------------------------------- |
115 | 124 |
116 // Creates a popup menu with |items|. | 125 // Creates a popup menu with |items|. |
117 // |multiple| defines if it should support multi-select. | 126 // |multiple| defines if it should support multi-select. |
118 // If not |multiple|, |selected_item| sets the initially selected item. | 127 // If not |multiple|, |selected_item| sets the initially selected item. |
119 // Otherwise, item's "checked" flag selects it. | 128 // Otherwise, item's "checked" flag selects it. |
120 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items, | 129 void ShowSelectPopupMenu(const std::vector<WebMenuItem>& items, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 int x, int y, | 188 int x, int y, |
180 float dx, float dy, bool link_preview_tap); | 189 float dx, float dy, bool link_preview_tap); |
181 | 190 |
182 void PostLoadUrl(const GURL& url); | 191 void PostLoadUrl(const GURL& url); |
183 | 192 |
184 struct JavaObject; | 193 struct JavaObject; |
185 JavaObject* java_object_; | 194 JavaObject* java_object_; |
186 | 195 |
187 // Reference to the current WebContents used to determine how and what to | 196 // Reference to the current WebContents used to determine how and what to |
188 // display in the ContentViewCore. | 197 // display in the ContentViewCore. |
189 WebContents* web_contents_; | 198 WebContentsImpl* web_contents_; |
190 | 199 |
191 // We only set this to be the delegate of the web_contents if we own it. | 200 // We only set this to be the delegate of the web_contents if we own it. |
192 scoped_ptr<ContentViewClient> content_view_client_; | 201 scoped_ptr<ContentViewClient> content_view_client_; |
193 | 202 |
194 // Whether the renderer backing this ContentViewCore has crashed. | 203 // Whether the renderer backing this ContentViewCore has crashed. |
195 bool tab_crashed_; | 204 bool tab_crashed_; |
196 | 205 |
197 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 206 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
198 }; | 207 }; |
199 | 208 |
200 bool RegisterContentViewCore(JNIEnv* env); | 209 bool RegisterContentViewCore(JNIEnv* env); |
201 | 210 |
202 } // namespace content | 211 } // namespace content |
203 | 212 |
204 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 213 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |