Chromium Code Reviews| 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 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/android/sys_utils.h" | 9 #include "base/android/sys_utils.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 switches::kDisableOverscrollEdgeEffect)), | 187 switches::kDisableOverscrollEdgeEffect)), |
| 188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), | 188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), |
| 189 gesture_provider_(CreateGestureProviderConfig(), this), | 189 gesture_provider_(CreateGestureProviderConfig(), this), |
| 190 flush_input_requested_(false), | 190 flush_input_requested_(false), |
| 191 accelerated_surface_route_id_(0), | 191 accelerated_surface_route_id_(0), |
| 192 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( | 192 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( |
| 193 widget_host->GetProcess()->GetID(), | 193 widget_host->GetProcess()->GetID(), |
| 194 widget_host->GetRoutingID()) != NULL), | 194 widget_host->GetRoutingID()) != NULL), |
| 195 frame_evictor_(new DelegatedFrameEvictor(this)), | 195 frame_evictor_(new DelegatedFrameEvictor(this)), |
| 196 locks_on_frame_count_(0), | 196 locks_on_frame_count_(0), |
| 197 observing_root_window_(false) { | 197 observing_root_window_(false), |
| 198 convert_touch_sequence_to_mouse_(false) { | |
| 198 host_->SetView(this); | 199 host_->SetView(this); |
| 199 SetContentViewCore(content_view_core); | 200 SetContentViewCore(content_view_core); |
| 200 ImageTransportFactoryAndroid::AddObserver(this); | 201 ImageTransportFactoryAndroid::AddObserver(this); |
| 201 } | 202 } |
| 202 | 203 |
| 203 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { | 204 RenderWidgetHostViewAndroid::~RenderWidgetHostViewAndroid() { |
| 204 ImageTransportFactoryAndroid::RemoveObserver(this); | 205 ImageTransportFactoryAndroid::RemoveObserver(this); |
| 205 SetContentViewCore(NULL); | 206 SetContentViewCore(NULL); |
| 206 DCHECK(ack_callbacks_.empty()); | 207 DCHECK(ack_callbacks_.empty()); |
| 207 if (resource_collection_.get()) | 208 if (resource_collection_.get()) |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 CHECK(RenderProcessHost::run_renderer_in_process()); | 541 CHECK(RenderProcessHost::run_renderer_in_process()); |
| 541 if (content_view_core_) | 542 if (content_view_core_) |
| 542 content_view_core_->OnSmartClipDataExtracted(result); | 543 content_view_core_->OnSmartClipDataExtracted(result); |
| 543 } | 544 } |
| 544 | 545 |
| 545 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 546 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
| 546 const ui::MotionEvent& event) { | 547 const ui::MotionEvent& event) { |
| 547 if (!host_) | 548 if (!host_) |
| 548 return false; | 549 return false; |
| 549 | 550 |
| 551 if (event.GetAction() == ui::MotionEvent::ACTION_DOWN) { | |
| 552 convert_touch_sequence_to_mouse_ = | |
|
jdduke (slow)
2014/06/20 16:52:49
Sorry, my previous comment was confusing.
You'll
Changwan Ryu
2014/06/23 06:39:22
Done.
| |
| 553 ContentViewCoreImpl::ShouldConvertToMouseEvent(event); | |
| 554 // TODO(changwan): add a gesture detector to handle the long press event. | |
|
jdduke (slow)
2014/06/20 16:52:49
If you move this block below as in the previous co
Changwan Ryu
2014/06/23 06:39:22
Done.
| |
| 555 } | |
| 556 | |
| 557 if (convert_touch_sequence_to_mouse_) { | |
| 558 SendMouseEvent(CreateWebMouseEventFromMotionEvent(event)); | |
| 559 gesture_provider_.OnTouchEventAck(false); | |
| 560 if (event.GetAction() == ui::MotionEvent::ACTION_UP || | |
|
jdduke (slow)
2014/06/20 16:52:49
I lied, we actually don't want this line to reset
Changwan Ryu
2014/06/23 06:39:22
Done.
| |
| 561 event.GetAction() == ui::MotionEvent::ACTION_CANCEL) | |
| 562 convert_touch_sequence_to_mouse_ = false; | |
| 563 return true; | |
| 564 } | |
| 565 | |
| 550 if (!gesture_provider_.OnTouchEvent(event)) | 566 if (!gesture_provider_.OnTouchEvent(event)) |
| 551 return false; | 567 return false; |
| 552 | 568 |
| 553 // Short-circuit touch forwarding if no touch handlers exist. | 569 // Short-circuit touch forwarding if no touch handlers exist. |
| 554 if (!host_->ShouldForwardTouchEvent()) { | 570 if (!host_->ShouldForwardTouchEvent()) { |
| 555 const bool event_consumed = false; | 571 const bool event_consumed = false; |
| 556 gesture_provider_.OnTouchEventAck(event_consumed); | 572 gesture_provider_.OnTouchEventAck(event_consumed); |
| 557 return true; | 573 return true; |
| 558 } | 574 } |
| 559 | 575 |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1272 | 1288 |
| 1273 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1289 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
| 1274 while (!ack_callbacks_.empty()) { | 1290 while (!ack_callbacks_.empty()) { |
| 1275 ack_callbacks_.front().Run(); | 1291 ack_callbacks_.front().Run(); |
| 1276 ack_callbacks_.pop(); | 1292 ack_callbacks_.pop(); |
| 1277 } | 1293 } |
| 1278 } | 1294 } |
| 1279 | 1295 |
| 1280 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1296 void RenderWidgetHostViewAndroid::OnGestureEvent( |
| 1281 const ui::GestureEventData& gesture) { | 1297 const ui::GestureEventData& gesture) { |
| 1282 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); | 1298 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); |
|
jdduke (slow)
2014/06/20 16:52:49
By using the same gesture detector, we can filter
jdduke (slow)
2014/06/20 21:57:58
Let's chat about this early next week. I'm thinki
Changwan Ryu
2014/06/23 06:39:22
I have uploaded a version that filters out gesture
| |
| 1283 } | 1299 } |
| 1284 | 1300 |
| 1285 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { | 1301 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { |
| 1286 RunAckCallbacks(); | 1302 RunAckCallbacks(); |
| 1287 } | 1303 } |
| 1288 | 1304 |
| 1289 void RenderWidgetHostViewAndroid::OnDetachCompositor() { | 1305 void RenderWidgetHostViewAndroid::OnDetachCompositor() { |
| 1290 DCHECK(content_view_core_); | 1306 DCHECK(content_view_core_); |
| 1291 DCHECK(!using_synchronous_compositor_); | 1307 DCHECK(!using_synchronous_compositor_); |
| 1292 RunAckCallbacks(); | 1308 RunAckCallbacks(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1436 results->availableRect = display.work_area(); | 1452 results->availableRect = display.work_area(); |
| 1437 results->deviceScaleFactor = display.device_scale_factor(); | 1453 results->deviceScaleFactor = display.device_scale_factor(); |
| 1438 results->orientationAngle = display.RotationAsDegree(); | 1454 results->orientationAngle = display.RotationAsDegree(); |
| 1439 gfx::DeviceDisplayInfo info; | 1455 gfx::DeviceDisplayInfo info; |
| 1440 results->depth = info.GetBitsPerPixel(); | 1456 results->depth = info.GetBitsPerPixel(); |
| 1441 results->depthPerComponent = info.GetBitsPerComponent(); | 1457 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1442 results->isMonochrome = (results->depthPerComponent == 0); | 1458 results->isMonochrome = (results->depthPerComponent == 0); |
| 1443 } | 1459 } |
| 1444 | 1460 |
| 1445 } // namespace content | 1461 } // namespace content |
| OLD | NEW |