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