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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 } else { | 1659 } else { |
1660 RequestToLockMouse(user_gesture, last_unlocked_by_target); | 1660 RequestToLockMouse(user_gesture, last_unlocked_by_target); |
1661 } | 1661 } |
1662 } | 1662 } |
1663 | 1663 |
1664 void RenderWidgetHostImpl::OnUnlockMouse() { | 1664 void RenderWidgetHostImpl::OnUnlockMouse() { |
1665 RejectMouseLockOrUnlockIfNecessary(); | 1665 RejectMouseLockOrUnlockIfNecessary(); |
1666 } | 1666 } |
1667 | 1667 |
1668 void RenderWidgetHostImpl::OnShowDisambiguationPopup( | 1668 void RenderWidgetHostImpl::OnShowDisambiguationPopup( |
1669 const gfx::Rect& rect, | 1669 const gfx::Rect& rect_pixels, |
1670 const gfx::Size& size, | 1670 const gfx::Size& size, |
1671 const cc::SharedBitmapId& id) { | 1671 const cc::SharedBitmapId& id) { |
1672 DCHECK(!rect.IsEmpty()); | 1672 DCHECK(!rect_pixels.IsEmpty()); |
1673 DCHECK(!size.IsEmpty()); | 1673 DCHECK(!size.IsEmpty()); |
1674 | 1674 |
1675 scoped_ptr<cc::SharedBitmap> bitmap = | 1675 scoped_ptr<cc::SharedBitmap> bitmap = |
1676 HostSharedBitmapManager::current()->GetSharedBitmapFromId(size, id); | 1676 HostSharedBitmapManager::current()->GetSharedBitmapFromId(size, id); |
1677 if (!bitmap) { | 1677 if (!bitmap) { |
1678 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH6")); | 1678 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH6")); |
1679 GetProcess()->ReceivedBadMessage(); | 1679 GetProcess()->ReceivedBadMessage(); |
1680 return; | 1680 return; |
1681 } | 1681 } |
1682 | 1682 |
1683 DCHECK(bitmap->pixels()); | 1683 DCHECK(bitmap->pixels()); |
1684 | 1684 |
1685 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 1685 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
1686 SkBitmap zoomed_bitmap; | 1686 SkBitmap zoomed_bitmap; |
1687 zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes()); | 1687 zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes()); |
1688 | 1688 |
1689 #if defined(OS_ANDROID) | 1689 #if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) |
| 1690 // Note that |rect| is in coordinates of pixels relative to the window origin. |
| 1691 // Aura-based systems will want to convert this to DIPs. |
1690 if (view_) | 1692 if (view_) |
1691 view_->ShowDisambiguationPopup(rect, zoomed_bitmap); | 1693 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); |
1692 #else | 1694 #else |
1693 NOTIMPLEMENTED(); | 1695 NOTIMPLEMENTED(); |
1694 #endif | 1696 #endif |
1695 | 1697 |
| 1698 // It is assumed that the disambiguation popup will make a copy of the |
| 1699 // provided zoomed image, so we delete this one. |
1696 zoomed_bitmap.setPixels(0); | 1700 zoomed_bitmap.setPixels(0); |
1697 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); | 1701 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); |
1698 } | 1702 } |
1699 | 1703 |
1700 #if defined(OS_WIN) | 1704 #if defined(OS_WIN) |
1701 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( | 1705 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( |
1702 gfx::NativeViewId dummy_activation_window) { | 1706 gfx::NativeViewId dummy_activation_window) { |
1703 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); | 1707 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
1704 | 1708 |
1705 // This may happen as a result of a race condition when the plugin is going | 1709 // This may happen as a result of a race condition when the plugin is going |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 } | 2326 } |
2323 #endif | 2327 #endif |
2324 | 2328 |
2325 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2329 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2326 if (view_) | 2330 if (view_) |
2327 return view_->PreferredReadbackFormat(); | 2331 return view_->PreferredReadbackFormat(); |
2328 return kN32_SkColorType; | 2332 return kN32_SkColorType; |
2329 } | 2333 } |
2330 | 2334 |
2331 } // namespace content | 2335 } // namespace content |
OLD | NEW |