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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 OnShowFullscreenWidget) | 886 OnShowFullscreenWidget) |
887 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 887 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
888 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 888 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
889 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | 889 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) |
890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
892 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 892 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
893 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 893 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
894 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 894 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
895 OnDocumentAvailableInMainFrame) | 895 OnDocumentAvailableInMainFrame) |
896 IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleFullscreen, OnToggleFullscreen) | |
897 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 896 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
898 OnDidContentsPreferredSizeChange) | 897 OnDidContentsPreferredSizeChange) |
899 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
900 OnRouteCloseEvent) | 899 OnRouteCloseEvent) |
901 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 900 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
902 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 901 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
903 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 902 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
904 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 903 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
905 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
906 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 905 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 if (!uses_temporary_zoom_level) | 1114 if (!uses_temporary_zoom_level) |
1116 return; | 1115 return; |
1117 | 1116 |
1118 HostZoomMapImpl* host_zoom_map = | 1117 HostZoomMapImpl* host_zoom_map = |
1119 static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); | 1118 static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); |
1120 host_zoom_map->SetTemporaryZoomLevel(GetProcess()->GetID(), | 1119 host_zoom_map->SetTemporaryZoomLevel(GetProcess()->GetID(), |
1121 GetRoutingID(), | 1120 GetRoutingID(), |
1122 host_zoom_map->GetDefaultZoomLevel()); | 1121 host_zoom_map->GetDefaultZoomLevel()); |
1123 } | 1122 } |
1124 | 1123 |
1125 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) { | 1124 void RenderViewHostImpl::EnterFullscreen(const GURL& origin) { |
1126 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1125 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1127 delegate_->ToggleFullscreenMode(enter_fullscreen); | 1126 |
1128 // We need to notify the contents that its fullscreen state has changed. This | 1127 delegate_->EnterFullscreenMode(origin); |
1129 // is done as part of the resize message. | 1128 |
| 1129 // The previous call might change the fullscreen state. We need to make sure |
| 1130 // the renderer is aware of that, which is done via the resize message. |
1130 WasResized(); | 1131 WasResized(); |
1131 } | 1132 } |
1132 | 1133 |
| 1134 void RenderViewHostImpl::ExitFullscreen() { |
| 1135 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1136 |
| 1137 RejectMouseLockOrUnlockIfNecessary(); |
| 1138 delegate_->ExitFullscreenMode(); |
| 1139 |
| 1140 // The previous call might change the fullscreen state. We need to make sure |
| 1141 // the renderer is aware of that, which is done via the resize message. |
| 1142 WasResized(); |
| 1143 } |
| 1144 |
1133 void RenderViewHostImpl::OnDidContentsPreferredSizeChange( | 1145 void RenderViewHostImpl::OnDidContentsPreferredSizeChange( |
1134 const gfx::Size& new_size) { | 1146 const gfx::Size& new_size) { |
1135 delegate_->UpdatePreferredSize(new_size); | 1147 delegate_->UpdatePreferredSize(new_size); |
1136 } | 1148 } |
1137 | 1149 |
1138 void RenderViewHostImpl::OnRenderAutoResized(const gfx::Size& new_size) { | 1150 void RenderViewHostImpl::OnRenderAutoResized(const gfx::Size& new_size) { |
1139 delegate_->ResizeDueToAutoResize(new_size); | 1151 delegate_->ResizeDueToAutoResize(new_size); |
1140 } | 1152 } |
1141 | 1153 |
1142 void RenderViewHostImpl::OnRouteCloseEvent() { | 1154 void RenderViewHostImpl::OnRouteCloseEvent() { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 | 1341 |
1330 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( | 1342 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( |
1331 const base::string16& content, | 1343 const base::string16& content, |
1332 size_t start_offset, | 1344 size_t start_offset, |
1333 size_t end_offset) { | 1345 size_t end_offset) { |
1334 if (!view_) | 1346 if (!view_) |
1335 return; | 1347 return; |
1336 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); | 1348 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); |
1337 } | 1349 } |
1338 | 1350 |
1339 void RenderViewHostImpl::ExitFullscreen() { | |
1340 RejectMouseLockOrUnlockIfNecessary(); | |
1341 // Notify delegate_ and renderer of fullscreen state change. | |
1342 OnToggleFullscreen(false); | |
1343 } | |
1344 | |
1345 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { | 1351 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { |
1346 if (!web_preferences_.get()) { | 1352 if (!web_preferences_.get()) { |
1347 OnWebkitPreferencesChanged(); | 1353 OnWebkitPreferencesChanged(); |
1348 } | 1354 } |
1349 return *web_preferences_; | 1355 return *web_preferences_; |
1350 } | 1356 } |
1351 | 1357 |
1352 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1358 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
1353 web_preferences_.reset(new WebPreferences(prefs)); | 1359 web_preferences_.reset(new WebPreferences(prefs)); |
1354 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); | 1360 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1490 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1485 | 1491 |
1486 frame_tree->ResetForMainFrameSwap(); | 1492 frame_tree->ResetForMainFrameSwap(); |
1487 } | 1493 } |
1488 | 1494 |
1489 void RenderViewHostImpl::SelectWordAroundCaret() { | 1495 void RenderViewHostImpl::SelectWordAroundCaret() { |
1490 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1496 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1491 } | 1497 } |
1492 | 1498 |
1493 } // namespace content | 1499 } // namespace content |
OLD | NEW |