| 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_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 1000 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
| 1001 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 1001 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 1002 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 1002 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
| 1003 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 1003 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 1004 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 1004 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
| 1005 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 1005 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
| 1006 #if defined(OS_ANDROID) | 1006 #if defined(OS_ANDROID) |
| 1007 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionRootBoundsChanged, | 1007 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectionRootBoundsChanged, |
| 1008 OnSelectionRootBoundsChanged) | 1008 OnSelectionRootBoundsChanged) |
| 1009 #endif | 1009 #endif |
| 1010 IPC_MESSAGE_HANDLER(ViewHostMsg_DidCreateDocument, |
| 1011 OnDidCreateDocument) |
| 1010 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 1012 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
| 1011 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 1013 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
| 1012 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) | 1014 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowPopup, OnShowPopup) |
| 1013 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) | 1015 IPC_MESSAGE_HANDLER(ViewHostMsg_HidePopup, OnHidePopup) |
| 1014 #endif | 1016 #endif |
| 1015 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 1017 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
| 1016 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) | 1018 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents) |
| 1017 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, | 1019 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_LocationChanges, |
| 1018 OnAccessibilityLocationChanges) | 1020 OnAccessibilityLocationChanges) |
| 1019 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | 1021 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 // events, and we can take the fast path. | 1179 // events, and we can take the fast path. |
| 1178 ClosePageIgnoringUnloadEvents(); | 1180 ClosePageIgnoringUnloadEvents(); |
| 1179 } | 1181 } |
| 1180 | 1182 |
| 1181 void RenderViewHostImpl::OnRequestMove(const gfx::Rect& pos) { | 1183 void RenderViewHostImpl::OnRequestMove(const gfx::Rect& pos) { |
| 1182 if (IsRVHStateActive(rvh_state_)) | 1184 if (IsRVHStateActive(rvh_state_)) |
| 1183 delegate_->RequestMove(pos); | 1185 delegate_->RequestMove(pos); |
| 1184 Send(new ViewMsg_Move_ACK(GetRoutingID())); | 1186 Send(new ViewMsg_Move_ACK(GetRoutingID())); |
| 1185 } | 1187 } |
| 1186 | 1188 |
| 1187 void RenderViewHostImpl::OnDocumentAvailableInMainFrame() { | 1189 void RenderViewHostImpl::OnDocumentAvailableInMainFrame( |
| 1190 bool uses_temporary_zoom_settings) { |
| 1188 delegate_->DocumentAvailableInMainFrame(this); | 1191 delegate_->DocumentAvailableInMainFrame(this); |
| 1192 OnDidCreateDocument(uses_temporary_zoom_settings); |
| 1189 } | 1193 } |
| 1190 | 1194 |
| 1191 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) { | 1195 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) { |
| 1192 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1196 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1193 delegate_->ToggleFullscreenMode(enter_fullscreen); | 1197 delegate_->ToggleFullscreenMode(enter_fullscreen); |
| 1194 // We need to notify the contents that its fullscreen state has changed. This | 1198 // We need to notify the contents that its fullscreen state has changed. This |
| 1195 // is done as part of the resize message. | 1199 // is done as part of the resize message. |
| 1196 WasResized(); | 1200 WasResized(); |
| 1197 } | 1201 } |
| 1198 | 1202 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1586 view_->CreateBrowserAccessibilityManagerIfNeeded(); | 1590 view_->CreateBrowserAccessibilityManagerIfNeeded(); |
| 1587 BrowserAccessibilityManager* manager = | 1591 BrowserAccessibilityManager* manager = |
| 1588 view_->GetBrowserAccessibilityManager(); | 1592 view_->GetBrowserAccessibilityManager(); |
| 1589 if (manager) | 1593 if (manager) |
| 1590 manager->OnLocationChanges(params); | 1594 manager->OnLocationChanges(params); |
| 1591 } | 1595 } |
| 1592 // TODO(aboxhall): send location change events to web contents observers too | 1596 // TODO(aboxhall): send location change events to web contents observers too |
| 1593 } | 1597 } |
| 1594 } | 1598 } |
| 1595 | 1599 |
| 1600 void RenderViewHostImpl::OnDidCreateDocument( |
| 1601 bool uses_temporary_zoom_settings) { |
| 1602 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( |
| 1603 HostZoomMap::GetForBrowserContext(GetProcess()->GetBrowserContext())); |
| 1604 host_zoom_map->SetUsesTemporaryZoomLevel( |
| 1605 GetProcess()->GetID(), GetRoutingID(), uses_temporary_zoom_settings); |
| 1606 } |
| 1607 |
| 1596 void RenderViewHostImpl::OnDidZoomURL(double zoom_level, | 1608 void RenderViewHostImpl::OnDidZoomURL(double zoom_level, |
| 1597 bool remember, | |
| 1598 const GURL& url) { | 1609 const GURL& url) { |
| 1599 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( | 1610 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( |
| 1600 HostZoomMap::GetForBrowserContext(GetProcess()->GetBrowserContext())); | 1611 HostZoomMap::GetForBrowserContext(GetProcess()->GetBrowserContext())); |
| 1601 if (remember) { | 1612 |
| 1602 host_zoom_map-> | 1613 host_zoom_map->SetZoomLevelForView(GetProcess()->GetID(), |
| 1603 SetZoomLevelForHost(net::GetHostOrSpecFromURL(url), zoom_level); | 1614 GetRoutingID(), |
| 1604 } else { | 1615 zoom_level, |
| 1605 host_zoom_map->SetTemporaryZoomLevel( | 1616 net::GetHostOrSpecFromURL(url)); |
| 1606 GetProcess()->GetID(), GetRoutingID(), zoom_level); | |
| 1607 } | |
| 1608 } | 1617 } |
| 1609 | 1618 |
| 1610 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { | 1619 void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) { |
| 1611 delegate_->RunFileChooser(this, params); | 1620 delegate_->RunFileChooser(this, params); |
| 1612 } | 1621 } |
| 1613 | 1622 |
| 1614 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { | 1623 void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) { |
| 1615 #if defined(OS_WIN) | 1624 #if defined(OS_WIN) |
| 1616 if (editable) { | 1625 if (editable) { |
| 1617 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); | 1626 virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1692 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1684 | 1693 |
| 1685 frame_tree->ResetForMainFrameSwap(); | 1694 frame_tree->ResetForMainFrameSwap(); |
| 1686 } | 1695 } |
| 1687 | 1696 |
| 1688 void RenderViewHostImpl::SelectWordAroundCaret() { | 1697 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1689 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1698 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1690 } | 1699 } |
| 1691 | 1700 |
| 1692 } // namespace content | 1701 } // namespace content |
| OLD | NEW |