| 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/android/scoped_java_ref.h" |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 17 #include "content/browser/renderer_host/input/touch_disposition_gesture_filter.h
" | 18 #include "content/browser/renderer_host/input/touch_disposition_gesture_filter.h
" |
| 18 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 19 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 19 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
| 20 #include "content/public/browser/android/content_view_core.h" | 21 #include "content/public/browser/android/content_view_core.h" |
| 21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 23 #include "content/public/browser/web_contents_observer.h" | 24 #include "content/public/browser/web_contents_observer.h" |
| 24 #include "third_party/WebKit/public/web/WebInputEvent.h" | 25 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
| 26 #include "ui/gfx/rect_f.h" | 27 #include "ui/gfx/rect_f.h" |
| 27 #include "url/gurl.h" | 28 #include "url/gurl.h" |
| 28 | 29 |
| 30 namespace gfx { |
| 31 class JavaBitmap; |
| 32 } |
| 33 |
| 29 namespace ui { | 34 namespace ui { |
| 30 class ViewAndroid; | 35 class ViewAndroid; |
| 31 class WindowAndroid; | 36 class WindowAndroid; |
| 32 } | 37 } |
| 33 | 38 |
| 34 namespace content { | 39 namespace content { |
| 35 class RenderWidgetHostViewAndroid; | 40 class RenderWidgetHostViewAndroid; |
| 36 struct MenuItem; | 41 struct MenuItem; |
| 37 | 42 |
| 38 // TODO(jrg): this is a shell. Upstream the rest. | 43 // TODO(jrg): this is a shell. Upstream the rest. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; | 57 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaObject() OVERRIDE; |
| 53 virtual WebContents* GetWebContents() const OVERRIDE; | 58 virtual WebContents* GetWebContents() const OVERRIDE; |
| 54 virtual ui::ViewAndroid* GetViewAndroid() const OVERRIDE; | 59 virtual ui::ViewAndroid* GetViewAndroid() const OVERRIDE; |
| 55 virtual ui::WindowAndroid* GetWindowAndroid() const OVERRIDE; | 60 virtual ui::WindowAndroid* GetWindowAndroid() const OVERRIDE; |
| 56 virtual scoped_refptr<cc::Layer> GetLayer() const OVERRIDE; | 61 virtual scoped_refptr<cc::Layer> GetLayer() const OVERRIDE; |
| 57 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; | 62 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; |
| 58 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) OVERRIDE; | 63 virtual jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj) OVERRIDE; |
| 59 virtual void ShowPastePopup(int x, int y) OVERRIDE; | 64 virtual void ShowPastePopup(int x, int y) OVERRIDE; |
| 60 virtual void GetScaledContentBitmap( | 65 virtual void GetScaledContentBitmap( |
| 61 float scale, | 66 float scale, |
| 62 const base::Callback<void(bool, const SkBitmap&)>& result_callback) | 67 const base::Callback<void(bool, const SkBitmap&)>& result_callback, |
| 68 SkBitmap::Config bitmap_config = SkBitmap::kARGB_8888_Config, |
| 69 const gfx::Rect& bounding_rect = gfx::Rect(), |
| 70 const BitmapAllocator bitmap_allocator = BitmapAllocator()) |
| 63 OVERRIDE; | 71 OVERRIDE; |
| 64 virtual float GetDpiScale() const OVERRIDE; | 72 virtual float GetDpiScale() const OVERRIDE; |
| 65 virtual void PauseVideo() OVERRIDE; | 73 virtual void PauseVideo() OVERRIDE; |
| 66 virtual void PauseOrResumeGeolocation(bool should_pause) OVERRIDE; | 74 virtual void PauseOrResumeGeolocation(bool should_pause) OVERRIDE; |
| 67 | 75 |
| 68 // -------------------------------------------------------------------------- | 76 // -------------------------------------------------------------------------- |
| 69 // Methods called from Java via JNI | 77 // Methods called from Java via JNI |
| 70 // -------------------------------------------------------------------------- | 78 // -------------------------------------------------------------------------- |
| 71 | 79 |
| 72 base::android::ScopedJavaLocalRef<jobject> GetWebContentsAndroid(JNIEnv* env, | 80 base::android::ScopedJavaLocalRef<jobject> GetWebContentsAndroid(JNIEnv* env, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 jint max_entries); | 201 jint max_entries); |
| 194 base::android::ScopedJavaLocalRef<jstring> | 202 base::android::ScopedJavaLocalRef<jstring> |
| 195 GetOriginalUrlForActiveNavigationEntry(JNIEnv* env, jobject obj); | 203 GetOriginalUrlForActiveNavigationEntry(JNIEnv* env, jobject obj); |
| 196 void UpdateVSyncParameters(JNIEnv* env, jobject obj, jlong timebase_micros, | 204 void UpdateVSyncParameters(JNIEnv* env, jobject obj, jlong timebase_micros, |
| 197 jlong interval_micros); | 205 jlong interval_micros); |
| 198 void OnVSync(JNIEnv* env, jobject /* obj */, jlong frame_time_micros); | 206 void OnVSync(JNIEnv* env, jobject /* obj */, jlong frame_time_micros); |
| 199 jboolean OnAnimate(JNIEnv* env, jobject /* obj */, jlong frame_time_micros); | 207 jboolean OnAnimate(JNIEnv* env, jobject /* obj */, jlong frame_time_micros); |
| 200 jboolean PopulateBitmapFromCompositor(JNIEnv* env, | 208 jboolean PopulateBitmapFromCompositor(JNIEnv* env, |
| 201 jobject obj, | 209 jobject obj, |
| 202 jobject jbitmap); | 210 jobject jbitmap); |
| 211 void PopulateBitmapFromCompositorAsync(JNIEnv* env, |
| 212 jobject obj, |
| 213 jint x, |
| 214 jint y, |
| 215 jint width, |
| 216 jint height, |
| 217 jfloat scale, |
| 218 jobject jbitmap_config); |
| 203 void WasResized(JNIEnv* env, jobject obj); | 219 void WasResized(JNIEnv* env, jobject obj); |
| 204 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); | 220 jboolean IsRenderWidgetHostViewReady(JNIEnv* env, jobject obj); |
| 205 void ExitFullscreen(JNIEnv* env, jobject obj); | 221 void ExitFullscreen(JNIEnv* env, jobject obj); |
| 206 void UpdateTopControlsState(JNIEnv* env, | 222 void UpdateTopControlsState(JNIEnv* env, |
| 207 jobject obj, | 223 jobject obj, |
| 208 bool enable_hiding, | 224 bool enable_hiding, |
| 209 bool enable_showing, | 225 bool enable_showing, |
| 210 bool animate); | 226 bool animate); |
| 211 void ShowImeIfNeeded(JNIEnv* env, jobject obj); | 227 void ShowImeIfNeeded(JNIEnv* env, jobject obj); |
| 212 | 228 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 237 void OnSmartClipDataExtracted(const base::string16& result); | 253 void OnSmartClipDataExtracted(const base::string16& result); |
| 238 | 254 |
| 239 // Creates a popup menu with |items|. | 255 // Creates a popup menu with |items|. |
| 240 // |multiple| defines if it should support multi-select. | 256 // |multiple| defines if it should support multi-select. |
| 241 // If not |multiple|, |selected_item| sets the initially selected item. | 257 // If not |multiple|, |selected_item| sets the initially selected item. |
| 242 // Otherwise, item's "checked" flag selects it. | 258 // Otherwise, item's "checked" flag selects it. |
| 243 void ShowSelectPopupMenu(const std::vector<MenuItem>& items, | 259 void ShowSelectPopupMenu(const std::vector<MenuItem>& items, |
| 244 int selected_item, | 260 int selected_item, |
| 245 bool multiple); | 261 bool multiple); |
| 246 | 262 |
| 263 void ProxyBitmapAllocator(SkBitmap*& bitmap, |
| 264 const gfx::Size& computed_size, |
| 265 SkBitmap::Config bitmap_config); |
| 266 |
| 247 void OnTabCrashed(); | 267 void OnTabCrashed(); |
| 268 void OnBitmapReady(bool result, const SkBitmap& bitmap); |
| 248 | 269 |
| 249 // All sizes and offsets are in CSS pixels as cached by the renderer. | 270 // All sizes and offsets are in CSS pixels as cached by the renderer. |
| 250 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, | 271 void UpdateFrameInfo(const gfx::Vector2dF& scroll_offset, |
| 251 float page_scale_factor, | 272 float page_scale_factor, |
| 252 const gfx::Vector2dF& page_scale_factor_limits, | 273 const gfx::Vector2dF& page_scale_factor_limits, |
| 253 const gfx::SizeF& content_size, | 274 const gfx::SizeF& content_size, |
| 254 const gfx::SizeF& viewport_size, | 275 const gfx::SizeF& viewport_size, |
| 255 const gfx::Vector2dF& controls_offset, | 276 const gfx::Vector2dF& controls_offset, |
| 256 const gfx::Vector2dF& content_offset, | 277 const gfx::Vector2dF& content_offset, |
| 257 float overdraw_bottom_height); | 278 float overdraw_bottom_height); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // will be sent to Renderer once it is ready. | 410 // will be sent to Renderer once it is ready. |
| 390 int device_orientation_; | 411 int device_orientation_; |
| 391 | 412 |
| 392 bool geolocation_needs_pause_; | 413 bool geolocation_needs_pause_; |
| 393 | 414 |
| 394 // Handles gesture dispatch as the generating touch events are ack'ed. | 415 // Handles gesture dispatch as the generating touch events are ack'ed. |
| 395 TouchDispositionGestureFilter touch_disposition_gesture_filter_; | 416 TouchDispositionGestureFilter touch_disposition_gesture_filter_; |
| 396 bool handling_touch_event_; | 417 bool handling_touch_event_; |
| 397 blink::WebTouchEvent pending_touch_event_; | 418 blink::WebTouchEvent pending_touch_event_; |
| 398 GestureEventPacket pending_gesture_packet_; | 419 GestureEventPacket pending_gesture_packet_; |
| 420 base::android::ScopedJavaGlobalRef<jobject> jbitmap_; |
| 421 scoped_ptr<gfx::JavaBitmap> java_bitmap_; |
| 399 | 422 |
| 400 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 423 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 401 }; | 424 }; |
| 402 | 425 |
| 403 bool RegisterContentViewCore(JNIEnv* env); | 426 bool RegisterContentViewCore(JNIEnv* env); |
| 404 | 427 |
| 405 } // namespace content | 428 } // namespace content |
| 406 | 429 |
| 407 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 430 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |