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 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1708 } else { | 1708 } else { |
1709 RequestToLockMouse(user_gesture, last_unlocked_by_target); | 1709 RequestToLockMouse(user_gesture, last_unlocked_by_target); |
1710 } | 1710 } |
1711 } | 1711 } |
1712 | 1712 |
1713 void RenderWidgetHostImpl::OnUnlockMouse() { | 1713 void RenderWidgetHostImpl::OnUnlockMouse() { |
1714 RejectMouseLockOrUnlockIfNecessary(); | 1714 RejectMouseLockOrUnlockIfNecessary(); |
1715 } | 1715 } |
1716 | 1716 |
1717 void RenderWidgetHostImpl::OnShowDisambiguationPopup( | 1717 void RenderWidgetHostImpl::OnShowDisambiguationPopup( |
1718 const gfx::Rect& rect, | 1718 const gfx::Rect& rect_pixels, |
1719 const gfx::Size& size, | 1719 const gfx::Size& size, |
1720 const cc::SharedBitmapId& id) { | 1720 const cc::SharedBitmapId& id) { |
1721 DCHECK(!rect.IsEmpty()); | 1721 DCHECK(!rect_pixels.IsEmpty()); |
1722 DCHECK(!size.IsEmpty()); | 1722 DCHECK(!size.IsEmpty()); |
1723 | 1723 |
1724 scoped_ptr<cc::SharedBitmap> bitmap = | 1724 scoped_ptr<cc::SharedBitmap> bitmap = |
1725 HostSharedBitmapManager::current()->GetSharedBitmapFromId(size, id); | 1725 HostSharedBitmapManager::current()->GetSharedBitmapFromId(size, id); |
1726 if (!bitmap) { | 1726 if (!bitmap) { |
1727 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH6")); | 1727 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH6")); |
1728 GetProcess()->ReceivedBadMessage(); | 1728 GetProcess()->ReceivedBadMessage(); |
1729 return; | 1729 return; |
1730 } | 1730 } |
1731 | 1731 |
1732 DCHECK(bitmap->pixels()); | 1732 DCHECK(bitmap->pixels()); |
1733 | 1733 |
1734 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); | 1734 SkImageInfo info = SkImageInfo::MakeN32Premul(size.width(), size.height()); |
1735 SkBitmap zoomed_bitmap; | 1735 SkBitmap zoomed_bitmap; |
1736 zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes()); | 1736 zoomed_bitmap.installPixels(info, bitmap->pixels(), info.minRowBytes()); |
1737 | 1737 |
1738 #if defined(OS_ANDROID) | 1738 #if defined(OS_ANDROID) || defined(TOOLKIT_VIEWS) |
| 1739 // Note that |rect| is in coordinates of pixels relative to the window origin. |
| 1740 // Aura-based systems will want to convert this to DIPs. |
1739 if (view_) | 1741 if (view_) |
1740 view_->ShowDisambiguationPopup(rect, zoomed_bitmap); | 1742 view_->ShowDisambiguationPopup(rect_pixels, zoomed_bitmap); |
1741 #else | 1743 #else |
1742 NOTIMPLEMENTED(); | 1744 NOTIMPLEMENTED(); |
1743 #endif | 1745 #endif |
1744 | 1746 |
| 1747 // It is assumed that the disambiguation popup will make a copy of the |
| 1748 // provided zoomed image, so we delete this one. |
1745 zoomed_bitmap.setPixels(0); | 1749 zoomed_bitmap.setPixels(0); |
1746 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); | 1750 Send(new ViewMsg_ReleaseDisambiguationPopupBitmap(GetRoutingID(), id)); |
1747 } | 1751 } |
1748 | 1752 |
1749 #if defined(OS_WIN) | 1753 #if defined(OS_WIN) |
1750 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( | 1754 void RenderWidgetHostImpl::OnWindowlessPluginDummyWindowCreated( |
1751 gfx::NativeViewId dummy_activation_window) { | 1755 gfx::NativeViewId dummy_activation_window) { |
1752 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); | 1756 HWND hwnd = reinterpret_cast<HWND>(dummy_activation_window); |
1753 | 1757 |
1754 // This may happen as a result of a race condition when the plugin is going | 1758 // 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... |
2371 } | 2375 } |
2372 #endif | 2376 #endif |
2373 | 2377 |
2374 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { | 2378 SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { |
2375 if (view_) | 2379 if (view_) |
2376 return view_->PreferredReadbackFormat(); | 2380 return view_->PreferredReadbackFormat(); |
2377 return kN32_SkColorType; | 2381 return kN32_SkColorType; |
2378 } | 2382 } |
2379 | 2383 |
2380 } // namespace content | 2384 } // namespace content |
OLD | NEW |