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 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 content_view_core_->DidStopFlinging(); | 1540 content_view_core_->DidStopFlinging(); |
1541 } | 1541 } |
1542 | 1542 |
1543 void RenderWidgetHostViewAndroid::SetContentViewCore( | 1543 void RenderWidgetHostViewAndroid::SetContentViewCore( |
1544 ContentViewCoreImpl* content_view_core) { | 1544 ContentViewCoreImpl* content_view_core) { |
1545 RemoveLayers(); | 1545 RemoveLayers(); |
1546 StopObservingRootWindow(); | 1546 StopObservingRootWindow(); |
1547 | 1547 |
1548 bool resize = false; | 1548 bool resize = false; |
1549 if (content_view_core != content_view_core_) { | 1549 if (content_view_core != content_view_core_) { |
| 1550 overscroll_effect_.reset(); |
1550 selection_controller_.reset(); | 1551 selection_controller_.reset(); |
1551 ReleaseLocksOnSurface(); | 1552 ReleaseLocksOnSurface(); |
1552 resize = true; | 1553 resize = true; |
1553 } | 1554 } |
1554 | 1555 |
1555 content_view_core_ = content_view_core; | 1556 content_view_core_ = content_view_core; |
1556 | 1557 |
1557 BrowserAccessibilityManager* manager = NULL; | 1558 BrowserAccessibilityManager* manager = NULL; |
1558 if (host_) | 1559 if (host_) |
1559 manager = host_->GetRootBrowserAccessibilityManager(); | 1560 manager = host_->GetRootBrowserAccessibilityManager(); |
(...skipping 10 matching lines...) Expand all Loading... |
1570 return; | 1571 return; |
1571 | 1572 |
1572 StartObservingRootWindow(); | 1573 StartObservingRootWindow(); |
1573 | 1574 |
1574 if (resize) | 1575 if (resize) |
1575 WasResized(); | 1576 WasResized(); |
1576 | 1577 |
1577 if (!selection_controller_) | 1578 if (!selection_controller_) |
1578 selection_controller_.reset(new TouchSelectionController(this)); | 1579 selection_controller_.reset(new TouchSelectionController(this)); |
1579 | 1580 |
1580 if (!content_view_core_) | 1581 if (overscroll_effect_enabled_ && !overscroll_effect_ && |
1581 overscroll_effect_.reset(); | 1582 content_view_core_->GetWindowAndroid()->GetCompositor()) |
1582 else if (overscroll_effect_enabled_ && !overscroll_effect_) | |
1583 overscroll_effect_ = CreateOverscrollEffect(content_view_core_); | 1583 overscroll_effect_ = CreateOverscrollEffect(content_view_core_); |
1584 } | 1584 } |
1585 | 1585 |
1586 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1586 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
1587 while (!ack_callbacks_.empty()) { | 1587 while (!ack_callbacks_.empty()) { |
1588 ack_callbacks_.front().Run(); | 1588 ack_callbacks_.front().Run(); |
1589 ack_callbacks_.pop(); | 1589 ack_callbacks_.pop(); |
1590 } | 1590 } |
1591 } | 1591 } |
1592 | 1592 |
1593 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1593 void RenderWidgetHostViewAndroid::OnGestureEvent( |
1594 const ui::GestureEventData& gesture) { | 1594 const ui::GestureEventData& gesture) { |
1595 if (gesture_text_selector_.OnGestureEvent(gesture)) | 1595 if (gesture_text_selector_.OnGestureEvent(gesture)) |
1596 return; | 1596 return; |
1597 | 1597 |
1598 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); | 1598 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture)); |
1599 } | 1599 } |
1600 | 1600 |
1601 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { | 1601 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { |
1602 RunAckCallbacks(); | 1602 RunAckCallbacks(); |
1603 } | 1603 } |
1604 | 1604 |
| 1605 |
| 1606 void RenderWidgetHostViewAndroid::OnAttachCompositor() { |
| 1607 DCHECK(content_view_core_); |
| 1608 if (overscroll_effect_enabled_ && !overscroll_effect_) |
| 1609 overscroll_effect_ = CreateOverscrollEffect(content_view_core_); |
| 1610 } |
| 1611 |
1605 void RenderWidgetHostViewAndroid::OnDetachCompositor() { | 1612 void RenderWidgetHostViewAndroid::OnDetachCompositor() { |
1606 DCHECK(content_view_core_); | 1613 DCHECK(content_view_core_); |
1607 DCHECK(!using_synchronous_compositor_); | 1614 DCHECK(!using_synchronous_compositor_); |
1608 RunAckCallbacks(); | 1615 RunAckCallbacks(); |
| 1616 overscroll_effect_.reset(); |
1609 } | 1617 } |
1610 | 1618 |
1611 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, | 1619 void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time, |
1612 base::TimeDelta vsync_period) { | 1620 base::TimeDelta vsync_period) { |
1613 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); | 1621 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); |
1614 if (!host_) | 1622 if (!host_) |
1615 return; | 1623 return; |
1616 | 1624 |
1617 const uint32 current_vsync_requests = outstanding_vsync_requests_; | 1625 const uint32 current_vsync_requests = outstanding_vsync_requests_; |
1618 outstanding_vsync_requests_ = 0; | 1626 outstanding_vsync_requests_ = 0; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 results->orientationAngle = display.RotationAsDegree(); | 1781 results->orientationAngle = display.RotationAsDegree(); |
1774 results->orientationType = | 1782 results->orientationType = |
1775 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1783 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1776 gfx::DeviceDisplayInfo info; | 1784 gfx::DeviceDisplayInfo info; |
1777 results->depth = info.GetBitsPerPixel(); | 1785 results->depth = info.GetBitsPerPixel(); |
1778 results->depthPerComponent = info.GetBitsPerComponent(); | 1786 results->depthPerComponent = info.GetBitsPerComponent(); |
1779 results->isMonochrome = (results->depthPerComponent == 0); | 1787 results->isMonochrome = (results->depthPerComponent == 0); |
1780 } | 1788 } |
1781 | 1789 |
1782 } // namespace content | 1790 } // namespace content |
OLD | NEW |