OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/android/jni_weak_ref.h" | 11 #include "base/android/jni_weak_ref.h" |
12 #include "base/basictypes.h" | |
13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
14 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/process/process.h" | 15 #include "base/process/process.h" |
17 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
18 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
19 #include "content/public/browser/android/content_view_core.h" | 18 #include "content/public/browser/android/content_view_core.h" |
20 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
21 #include "third_party/WebKit/public/web/WebInputEvent.h" | 20 #include "third_party/WebKit/public/web/WebInputEvent.h" |
22 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 virtual void ShowPastePopup(int x, int y) OVERRIDE; | 54 virtual void ShowPastePopup(int x, int y) OVERRIDE; |
56 virtual void GetScaledContentBitmap( | 55 virtual void GetScaledContentBitmap( |
57 float scale, | 56 float scale, |
58 jobject bitmap_config, | 57 jobject bitmap_config, |
59 gfx::Rect src_subrect, | 58 gfx::Rect src_subrect, |
60 const base::Callback<void(bool, const SkBitmap&)>& result_callback) | 59 const base::Callback<void(bool, const SkBitmap&)>& result_callback) |
61 OVERRIDE; | 60 OVERRIDE; |
62 virtual float GetDpiScale() const OVERRIDE; | 61 virtual float GetDpiScale() const OVERRIDE; |
63 virtual void PauseVideo() OVERRIDE; | 62 virtual void PauseVideo() OVERRIDE; |
64 virtual void PauseOrResumeGeolocation(bool should_pause) OVERRIDE; | 63 virtual void PauseOrResumeGeolocation(bool should_pause) OVERRIDE; |
| 64 virtual void RequestTextSurroundingSelection( |
| 65 int max_length, |
| 66 const TextSurroundingSelectionCallback& callback) OVERRIDE; |
65 | 67 |
66 // -------------------------------------------------------------------------- | 68 // -------------------------------------------------------------------------- |
67 // Methods called from Java via JNI | 69 // Methods called from Java via JNI |
68 // -------------------------------------------------------------------------- | 70 // -------------------------------------------------------------------------- |
69 | 71 |
70 base::android::ScopedJavaLocalRef<jobject> GetWebContentsAndroid(JNIEnv* env, | 72 base::android::ScopedJavaLocalRef<jobject> GetWebContentsAndroid(JNIEnv* env, |
71 jobject obj); | 73 jobject obj); |
72 | 74 |
73 void OnJavaContentViewCoreDestroyed(JNIEnv* env, jobject obj); | 75 void OnJavaContentViewCoreDestroyed(JNIEnv* env, jobject obj); |
74 | 76 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 jobject obj, | 221 jobject obj, |
220 jint x, | 222 jint x, |
221 jint y, | 223 jint y, |
222 jint width, | 224 jint width, |
223 jint height); | 225 jint height); |
224 | 226 |
225 void SetBackgroundOpaque(JNIEnv* env, jobject jobj, jboolean opaque); | 227 void SetBackgroundOpaque(JNIEnv* env, jobject jobj, jboolean opaque); |
226 | 228 |
227 jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj); | 229 jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj); |
228 | 230 |
| 231 void OnTextSurroundingSelectionResponse(const base::string16& content, |
| 232 int start_offset, |
| 233 int end_offset); |
| 234 |
| 235 |
229 // -------------------------------------------------------------------------- | 236 // -------------------------------------------------------------------------- |
230 // Public methods that call to Java via JNI | 237 // Public methods that call to Java via JNI |
231 // -------------------------------------------------------------------------- | 238 // -------------------------------------------------------------------------- |
232 | 239 |
233 void OnSmartClipDataExtracted(const base::string16& result); | 240 void OnSmartClipDataExtracted(const base::string16& result); |
234 | 241 |
235 // Creates a popup menu with |items|. | 242 // Creates a popup menu with |items|. |
236 // |multiple| defines if it should support multi-select. | 243 // |multiple| defines if it should support multi-select. |
237 // If not |multiple|, |selected_item| sets the initially selected item. | 244 // If not |multiple|, |selected_item| sets the initially selected item. |
238 // Otherwise, item's "checked" flag selects it. | 245 // Otherwise, item's "checked" flag selects it. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 // The cache of device's current orientation set from Java side, this value | 378 // The cache of device's current orientation set from Java side, this value |
372 // will be sent to Renderer once it is ready. | 379 // will be sent to Renderer once it is ready. |
373 int device_orientation_; | 380 int device_orientation_; |
374 | 381 |
375 bool accessibility_enabled_; | 382 bool accessibility_enabled_; |
376 | 383 |
377 // Manages injecting Java objects. | 384 // Manages injecting Java objects. |
378 scoped_ptr<JavaBridgeDispatcherHostManager> | 385 scoped_ptr<JavaBridgeDispatcherHostManager> |
379 java_bridge_dispatcher_host_manager_; | 386 java_bridge_dispatcher_host_manager_; |
380 | 387 |
| 388 TextSurroundingSelectionCallback text_surroundings_callback_; |
| 389 |
381 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 390 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
382 }; | 391 }; |
383 | 392 |
384 bool RegisterContentViewCore(JNIEnv* env); | 393 bool RegisterContentViewCore(JNIEnv* env); |
385 | 394 |
386 } // namespace content | 395 } // namespace content |
387 | 396 |
388 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 397 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
OLD | NEW |