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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 OnShowFullscreenWidget) | 880 OnShowFullscreenWidget) |
881 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 881 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
882 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 882 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
883 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | 883 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) |
884 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 884 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
885 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 885 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
886 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 886 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
887 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 887 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
888 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 888 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
889 OnDocumentAvailableInMainFrame) | 889 OnDocumentAvailableInMainFrame) |
890 IPC_MESSAGE_HANDLER(ViewHostMsg_ToggleFullscreen, OnToggleFullscreen) | |
891 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 890 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
892 OnDidContentsPreferredSizeChange) | 891 OnDidContentsPreferredSizeChange) |
893 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 892 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
894 OnRouteCloseEvent) | 893 OnRouteCloseEvent) |
895 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 894 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
896 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 895 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
897 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 896 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
898 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 897 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
899 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 898 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
900 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 899 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 if (!uses_temporary_zoom_level) | 1108 if (!uses_temporary_zoom_level) |
1110 return; | 1109 return; |
1111 | 1110 |
1112 HostZoomMapImpl* host_zoom_map = | 1111 HostZoomMapImpl* host_zoom_map = |
1113 static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); | 1112 static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); |
1114 host_zoom_map->SetTemporaryZoomLevel(GetProcess()->GetID(), | 1113 host_zoom_map->SetTemporaryZoomLevel(GetProcess()->GetID(), |
1115 GetRoutingID(), | 1114 GetRoutingID(), |
1116 host_zoom_map->GetDefaultZoomLevel()); | 1115 host_zoom_map->GetDefaultZoomLevel()); |
1117 } | 1116 } |
1118 | 1117 |
1119 void RenderViewHostImpl::OnToggleFullscreen(bool enter_fullscreen) { | |
1120 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
1121 delegate_->ToggleFullscreenMode(enter_fullscreen); | |
1122 // We need to notify the contents that its fullscreen state has changed. This | |
1123 // is done as part of the resize message. | |
1124 WasResized(); | |
1125 } | |
1126 | |
1127 void RenderViewHostImpl::OnDidContentsPreferredSizeChange( | 1118 void RenderViewHostImpl::OnDidContentsPreferredSizeChange( |
1128 const gfx::Size& new_size) { | 1119 const gfx::Size& new_size) { |
1129 delegate_->UpdatePreferredSize(new_size); | 1120 delegate_->UpdatePreferredSize(new_size); |
1130 } | 1121 } |
1131 | 1122 |
1132 void RenderViewHostImpl::OnRenderAutoResized(const gfx::Size& new_size) { | 1123 void RenderViewHostImpl::OnRenderAutoResized(const gfx::Size& new_size) { |
1133 delegate_->ResizeDueToAutoResize(new_size); | 1124 delegate_->ResizeDueToAutoResize(new_size); |
1134 } | 1125 } |
1135 | 1126 |
1136 void RenderViewHostImpl::OnRouteCloseEvent() { | 1127 void RenderViewHostImpl::OnRouteCloseEvent() { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 | 1314 |
1324 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( | 1315 void RenderViewHostImpl::OnTextSurroundingSelectionResponse( |
1325 const base::string16& content, | 1316 const base::string16& content, |
1326 size_t start_offset, | 1317 size_t start_offset, |
1327 size_t end_offset) { | 1318 size_t end_offset) { |
1328 if (!view_) | 1319 if (!view_) |
1329 return; | 1320 return; |
1330 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); | 1321 view_->OnTextSurroundingSelectionResponse(content, start_offset, end_offset); |
1331 } | 1322 } |
1332 | 1323 |
1333 void RenderViewHostImpl::ExitFullscreen() { | |
1334 RejectMouseLockOrUnlockIfNecessary(); | |
1335 // Notify delegate_ and renderer of fullscreen state change. | |
1336 OnToggleFullscreen(false); | |
1337 } | |
1338 | |
1339 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { | 1324 WebPreferences RenderViewHostImpl::GetWebkitPreferences() { |
1340 if (!web_preferences_.get()) { | 1325 if (!web_preferences_.get()) { |
1341 OnWebkitPreferencesChanged(); | 1326 OnWebkitPreferencesChanged(); |
1342 } | 1327 } |
1343 return *web_preferences_; | 1328 return *web_preferences_; |
1344 } | 1329 } |
1345 | 1330 |
1346 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { | 1331 void RenderViewHostImpl::UpdateWebkitPreferences(const WebPreferences& prefs) { |
1347 web_preferences_.reset(new WebPreferences(prefs)); | 1332 web_preferences_.reset(new WebPreferences(prefs)); |
1348 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); | 1333 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1463 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1479 | 1464 |
1480 frame_tree->ResetForMainFrameSwap(); | 1465 frame_tree->ResetForMainFrameSwap(); |
1481 } | 1466 } |
1482 | 1467 |
1483 void RenderViewHostImpl::SelectWordAroundCaret() { | 1468 void RenderViewHostImpl::SelectWordAroundCaret() { |
1484 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1469 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1485 } | 1470 } |
1486 | 1471 |
1487 } // namespace content | 1472 } // namespace content |
OLD | NEW |