Chromium Code Reviews| 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_helper.h" | 11 #include "base/android/jni_helper.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "content/browser/renderer_host/input/gesture_event_queue.h" | |
| 17 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 18 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 19 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/public/browser/android/content_view_core.h" | 20 #include "content/public/browser/android/content_view_core.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/web_contents_observer.h" | 23 #include "content/public/browser/web_contents_observer.h" |
| 23 #include "third_party/WebKit/public/web/WebInputEvent.h" | 24 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 24 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 25 #include "ui/gfx/rect_f.h" | 26 #include "ui/gfx/rect_f.h" |
| 26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 27 | 28 |
| 28 namespace ui { | 29 namespace ui { |
| 29 class ViewAndroid; | 30 class ViewAndroid; |
| 30 class WindowAndroid; | 31 class WindowAndroid; |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace content { | 34 namespace content { |
| 34 class RenderWidgetHostViewAndroid; | 35 class RenderWidgetHostViewAndroid; |
| 35 struct MenuItem; | 36 struct MenuItem; |
| 36 | 37 |
| 37 // TODO(jrg): this is a shell. Upstream the rest. | 38 // TODO(jrg): this is a shell. Upstream the rest. |
| 38 class ContentViewCoreImpl : public ContentViewCore, | 39 class ContentViewCoreImpl : public ContentViewCore, |
| 39 public NotificationObserver, | 40 public NotificationObserver, |
| 40 public WebContentsObserver { | 41 public WebContentsObserver, |
| 42 public GestureEventQueueClient { | |
| 41 public: | 43 public: |
| 42 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); | 44 static ContentViewCoreImpl* FromWebContents(WebContents* web_contents); |
| 43 ContentViewCoreImpl(JNIEnv* env, | 45 ContentViewCoreImpl(JNIEnv* env, |
| 44 jobject obj, | 46 jobject obj, |
| 45 bool hardware_accelerated, | 47 bool hardware_accelerated, |
| 46 WebContents* web_contents, | 48 WebContents* web_contents, |
| 47 ui::ViewAndroid* view_android, | 49 ui::ViewAndroid* view_android, |
| 48 ui::WindowAndroid* window_android); | 50 ui::WindowAndroid* window_android); |
| 49 | 51 |
| 50 // ContentViewCore implementation. | 52 // ContentViewCore implementation. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 jstring extra_headers, | 90 jstring extra_headers, |
| 89 jbyteArray post_data, | 91 jbyteArray post_data, |
| 90 jstring base_url_for_data_url, | 92 jstring base_url_for_data_url, |
| 91 jstring virtual_url_for_data_url, | 93 jstring virtual_url_for_data_url, |
| 92 jboolean can_load_local_resources); | 94 jboolean can_load_local_resources); |
| 93 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; | 95 base::android::ScopedJavaLocalRef<jstring> GetURL(JNIEnv* env, jobject) const; |
| 94 base::android::ScopedJavaLocalRef<jstring> GetTitle( | 96 base::android::ScopedJavaLocalRef<jstring> GetTitle( |
| 95 JNIEnv* env, jobject obj) const; | 97 JNIEnv* env, jobject obj) const; |
| 96 jboolean IsIncognito(JNIEnv* env, jobject obj); | 98 jboolean IsIncognito(JNIEnv* env, jobject obj); |
| 97 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); | 99 void SendOrientationChangeEvent(JNIEnv* env, jobject obj, jint orientation); |
| 98 jboolean SendTouchEvent(JNIEnv* env, | 100 void OnTouchEventHandlingBegin(JNIEnv* env, |
| 99 jobject obj, | 101 jobject obj, |
| 100 jlong time_ms, | 102 jlong time_ms, |
| 101 jint type, | 103 jint type, |
| 102 jobjectArray pts); | 104 jobjectArray pts); |
| 105 void OnTouchEventHandlingEnd(JNIEnv* env, jobject obj); | |
| 103 jboolean SendMouseMoveEvent(JNIEnv* env, | 106 jboolean SendMouseMoveEvent(JNIEnv* env, |
| 104 jobject obj, | 107 jobject obj, |
| 105 jlong time_ms, | 108 jlong time_ms, |
| 106 jfloat x, | 109 jfloat x, |
| 107 jfloat y); | 110 jfloat y); |
| 108 jboolean SendMouseWheelEvent(JNIEnv* env, | 111 jboolean SendMouseWheelEvent(JNIEnv* env, |
| 109 jobject obj, | 112 jobject obj, |
| 110 jlong time_ms, | 113 jlong time_ms, |
| 111 jfloat x, | 114 jfloat x, |
| 112 jfloat y, | 115 jfloat y, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 void UpdateImeAdapter(int native_ime_adapter, int text_input_type, | 266 void UpdateImeAdapter(int native_ime_adapter, int text_input_type, |
| 264 const std::string& text, | 267 const std::string& text, |
| 265 int selection_start, int selection_end, | 268 int selection_start, int selection_end, |
| 266 int composition_start, int composition_end, | 269 int composition_start, int composition_end, |
| 267 bool show_ime_if_needed, bool require_ack); | 270 bool show_ime_if_needed, bool require_ack); |
| 268 void SetTitle(const base::string16& title); | 271 void SetTitle(const base::string16& title); |
| 269 void OnBackgroundColorChanged(SkColor color); | 272 void OnBackgroundColorChanged(SkColor color); |
| 270 | 273 |
| 271 bool HasFocus(); | 274 bool HasFocus(); |
| 272 void ConfirmTouchEvent(InputEventAckState ack_result); | 275 void ConfirmTouchEvent(InputEventAckState ack_result); |
| 273 void UnhandledFlingStartEvent(); | 276 void UnhandledFlingStartEvent(float vx, float vy); |
| 274 void OnScrollUpdateGestureConsumed(); | 277 void OnScrollUpdateGestureConsumed(); |
| 275 void HasTouchEventHandlers(bool need_touch_events); | |
| 276 void OnSelectionChanged(const std::string& text); | 278 void OnSelectionChanged(const std::string& text); |
| 277 void OnSelectionBoundsChanged( | 279 void OnSelectionBoundsChanged( |
| 278 const ViewHostMsg_SelectionBounds_Params& params); | 280 const ViewHostMsg_SelectionBounds_Params& params); |
| 279 | 281 |
| 280 void StartContentIntent(const GURL& content_url); | 282 void StartContentIntent(const GURL& content_url); |
| 281 | 283 |
| 282 // Shows the disambiguation popup | 284 // Shows the disambiguation popup |
| 283 // |target_rect| --> window coordinates which |zoomed_bitmap| represents | 285 // |target_rect| --> window coordinates which |zoomed_bitmap| represents |
| 284 // |zoomed_bitmap| --> magnified image of potential touch targets | 286 // |zoomed_bitmap| --> magnified image of potential touch targets |
| 285 void ShowDisambiguationPopup( | 287 void ShowDisambiguationPopup( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 virtual ~ContentViewCoreImpl(); | 327 virtual ~ContentViewCoreImpl(); |
| 326 | 328 |
| 327 // NotificationObserver implementation. | 329 // NotificationObserver implementation. |
| 328 virtual void Observe(int type, | 330 virtual void Observe(int type, |
| 329 const NotificationSource& source, | 331 const NotificationSource& source, |
| 330 const NotificationDetails& details) OVERRIDE; | 332 const NotificationDetails& details) OVERRIDE; |
| 331 | 333 |
| 332 // WebContentsObserver implementation. | 334 // WebContentsObserver implementation. |
| 333 virtual void RenderViewReady() OVERRIDE; | 335 virtual void RenderViewReady() OVERRIDE; |
| 334 | 336 |
| 337 // GestureEventQueueClient implementation. | |
| 338 virtual void ForwardGestureEvent( | |
| 339 const blink::WebGestureEvent& event) OVERRIDE; | |
| 340 | |
| 335 // -------------------------------------------------------------------------- | 341 // -------------------------------------------------------------------------- |
| 336 // Other private methods and data | 342 // Other private methods and data |
| 337 // -------------------------------------------------------------------------- | 343 // -------------------------------------------------------------------------- |
| 338 | 344 |
| 339 void InitWebContents(); | 345 void InitWebContents(); |
| 340 | 346 |
| 341 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); | 347 RenderWidgetHostViewAndroid* GetRenderWidgetHostViewAndroid(); |
| 342 | 348 |
| 343 float GetTouchPaddingDip(); | 349 float GetTouchPaddingDip(); |
| 344 | 350 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 | 391 |
| 386 // The owning window that has a hold of main application activity. | 392 // The owning window that has a hold of main application activity. |
| 387 ui::WindowAndroid* window_android_; | 393 ui::WindowAndroid* window_android_; |
| 388 | 394 |
| 389 // The cache of device's current orientation set from Java side, this value | 395 // The cache of device's current orientation set from Java side, this value |
| 390 // will be sent to Renderer once it is ready. | 396 // will be sent to Renderer once it is ready. |
| 391 int device_orientation_; | 397 int device_orientation_; |
| 392 | 398 |
| 393 bool geolocation_needs_pause_; | 399 bool geolocation_needs_pause_; |
| 394 | 400 |
| 401 scoped_ptr<GestureEventQueue> gesture_event_queue_; | |
|
tdresser
2014/01/16 14:31:45
Why not just allocate this on the stack?
jdduke (slow)
2014/01/16 17:17:53
I had this behind a flag before, so there's no lon
| |
| 402 bool handling_touch_event_; | |
| 403 blink::WebTouchEvent pending_touch_event_; | |
| 404 GestureEventPacket pending_gesture_packet_; | |
| 405 | |
| 395 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 406 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 396 }; | 407 }; |
| 397 | 408 |
| 398 bool RegisterContentViewCore(JNIEnv* env); | 409 bool RegisterContentViewCore(JNIEnv* env); |
| 399 | 410 |
| 400 } // namespace content | 411 } // namespace content |
| 401 | 412 |
| 402 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 413 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |