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/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 210 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
211 RenderWidgetHostImpl* widget_host, | 211 RenderWidgetHostImpl* widget_host, |
212 ContentViewCoreImpl* content_view_core) | 212 ContentViewCoreImpl* content_view_core) |
213 : host_(widget_host), | 213 : host_(widget_host), |
214 outstanding_vsync_requests_(0), | 214 outstanding_vsync_requests_(0), |
215 is_showing_(!widget_host->is_hidden()), | 215 is_showing_(!widget_host->is_hidden()), |
216 content_view_core_(NULL), | 216 content_view_core_(NULL), |
217 ime_adapter_android_(this), | 217 ime_adapter_android_(this), |
218 cached_background_color_(SK_ColorWHITE), | 218 cached_background_color_(SK_ColorWHITE), |
219 last_output_surface_id_(kUndefinedOutputSurfaceId), | 219 last_output_surface_id_(kUndefinedOutputSurfaceId), |
220 overscroll_controller_enabled_( | |
221 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
222 switches::kDisableOverscrollEdgeEffect)), | |
223 gesture_provider_(CreateGestureProviderConfig(), this), | 220 gesture_provider_(CreateGestureProviderConfig(), this), |
224 gesture_text_selector_(this), | 221 gesture_text_selector_(this), |
225 accelerated_surface_route_id_(0), | 222 accelerated_surface_route_id_(0), |
226 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( | 223 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( |
227 widget_host->GetProcess()->GetID(), | 224 widget_host->GetProcess()->GetID(), |
228 widget_host->GetRoutingID()) != NULL), | 225 widget_host->GetRoutingID()) != NULL), |
229 frame_evictor_(new DelegatedFrameEvictor(this)), | 226 frame_evictor_(new DelegatedFrameEvictor(this)), |
230 locks_on_frame_count_(0), | 227 locks_on_frame_count_(0), |
231 observing_root_window_(false), | 228 observing_root_window_(false), |
232 weak_ptr_factory_(this) { | 229 weak_ptr_factory_(this) { |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 return; | 1541 return; |
1545 | 1542 |
1546 StartObservingRootWindow(); | 1543 StartObservingRootWindow(); |
1547 | 1544 |
1548 if (resize) | 1545 if (resize) |
1549 WasResized(); | 1546 WasResized(); |
1550 | 1547 |
1551 if (!selection_controller_) | 1548 if (!selection_controller_) |
1552 selection_controller_ = CreateSelectionController(this, content_view_core_); | 1549 selection_controller_ = CreateSelectionController(this, content_view_core_); |
1553 | 1550 |
1554 if (overscroll_controller_enabled_ && !overscroll_controller_ && | 1551 if (!overscroll_controller_ && |
1555 content_view_core_->GetWindowAndroid()->GetCompositor()) { | 1552 content_view_core_->GetWindowAndroid()->GetCompositor()) { |
1556 overscroll_controller_ = CreateOverscrollController(content_view_core_); | 1553 overscroll_controller_ = CreateOverscrollController(content_view_core_); |
1557 } | 1554 } |
1558 } | 1555 } |
1559 | 1556 |
1560 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1557 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
1561 while (!ack_callbacks_.empty()) { | 1558 while (!ack_callbacks_.empty()) { |
1562 ack_callbacks_.front().Run(); | 1559 ack_callbacks_.front().Run(); |
1563 ack_callbacks_.pop(); | 1560 ack_callbacks_.pop(); |
1564 } | 1561 } |
1565 } | 1562 } |
1566 | 1563 |
1567 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1564 void RenderWidgetHostViewAndroid::OnGestureEvent( |
1568 const ui::GestureEventData& gesture) { | 1565 const ui::GestureEventData& gesture) { |
1569 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); | 1566 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); |
1570 } | 1567 } |
1571 | 1568 |
1572 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { | 1569 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { |
1573 RunAckCallbacks(); | 1570 RunAckCallbacks(); |
1574 } | 1571 } |
1575 | 1572 |
1576 void RenderWidgetHostViewAndroid::OnAttachCompositor() { | 1573 void RenderWidgetHostViewAndroid::OnAttachCompositor() { |
1577 DCHECK(content_view_core_); | 1574 DCHECK(content_view_core_); |
1578 if (overscroll_controller_enabled_ && !overscroll_controller_) | 1575 if (!overscroll_controller_) |
1579 overscroll_controller_ = CreateOverscrollController(content_view_core_); | 1576 overscroll_controller_ = CreateOverscrollController(content_view_core_); |
1580 } | 1577 } |
1581 | 1578 |
1582 void RenderWidgetHostViewAndroid::OnDetachCompositor() { | 1579 void RenderWidgetHostViewAndroid::OnDetachCompositor() { |
1583 DCHECK(content_view_core_); | 1580 DCHECK(content_view_core_); |
1584 DCHECK(!using_synchronous_compositor_); | 1581 DCHECK(!using_synchronous_compositor_); |
1585 RunAckCallbacks(); | 1582 RunAckCallbacks(); |
1586 overscroll_controller_.reset(); | 1583 overscroll_controller_.reset(); |
1587 } | 1584 } |
1588 | 1585 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 results->orientationAngle = display.RotationAsDegree(); | 1745 results->orientationAngle = display.RotationAsDegree(); |
1749 results->orientationType = | 1746 results->orientationType = |
1750 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1747 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1751 gfx::DeviceDisplayInfo info; | 1748 gfx::DeviceDisplayInfo info; |
1752 results->depth = info.GetBitsPerPixel(); | 1749 results->depth = info.GetBitsPerPixel(); |
1753 results->depthPerComponent = info.GetBitsPerComponent(); | 1750 results->depthPerComponent = info.GetBitsPerComponent(); |
1754 results->isMonochrome = (results->depthPerComponent == 0); | 1751 results->isMonochrome = (results->depthPerComponent == 0); |
1755 } | 1752 } |
1756 | 1753 |
1757 } // namespace content | 1754 } // namespace content |
OLD | NEW |