OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 GetSiteInstance()->decrement_active_frame_count(); | 191 GetSiteInstance()->decrement_active_frame_count(); |
192 | 192 |
193 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 193 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
194 // the corresponding RenderViewHost if it is no longer needed. | 194 // the corresponding RenderViewHost if it is no longer needed. |
195 frame_tree_->UnregisterRenderFrameHost(this); | 195 frame_tree_->UnregisterRenderFrameHost(this); |
196 | 196 |
197 // NULL out the swapout timer; in crash dumps this member will be null only if | 197 // NULL out the swapout timer; in crash dumps this member will be null only if |
198 // the dtor has run. | 198 // the dtor has run. |
199 swapout_event_monitor_timeout_.reset(); | 199 swapout_event_monitor_timeout_.reset(); |
200 | 200 |
| 201 for (const auto& iter: flush_visual_state_callbacks_) { |
| 202 iter.second.Run(false); |
| 203 } |
| 204 |
201 if (render_widget_host_) | 205 if (render_widget_host_) |
202 render_widget_host_->Cleanup(); | 206 render_widget_host_->Cleanup(); |
203 } | 207 } |
204 | 208 |
205 int RenderFrameHostImpl::GetRoutingID() { | 209 int RenderFrameHostImpl::GetRoutingID() { |
206 return routing_id_; | 210 return routing_id_; |
207 } | 211 } |
208 | 212 |
209 SiteInstanceImpl* RenderFrameHostImpl::GetSiteInstance() { | 213 SiteInstanceImpl* RenderFrameHostImpl::GetSiteInstance() { |
210 return site_instance_.get(); | 214 return site_instance_.get(); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 OnDidCommitProvisionalLoad(msg)) | 342 OnDidCommitProvisionalLoad(msg)) |
339 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) | 343 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) |
340 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 344 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
341 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, | 345 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, |
342 OnDocumentOnLoadCompleted) | 346 OnDocumentOnLoadCompleted) |
343 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) | 347 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) |
344 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 348 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
345 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 349 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
346 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, | 350 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, |
347 OnJavaScriptExecuteResponse) | 351 OnJavaScriptExecuteResponse) |
| 352 IPC_MESSAGE_HANDLER(FrameHostMsg_FlushVisualStateResponse, |
| 353 OnFlushVisualStateResponse) |
348 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, | 354 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, |
349 OnRunJavaScriptMessage) | 355 OnRunJavaScriptMessage) |
350 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 356 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
351 OnRunBeforeUnloadConfirm) | 357 OnRunBeforeUnloadConfirm) |
352 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 358 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
353 OnDidAccessInitialDocument) | 359 OnDidAccessInitialDocument) |
354 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 360 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
355 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) | 361 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) |
356 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 362 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
357 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 363 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 std::map<int, JavaScriptResultCallback>::iterator it = | 1046 std::map<int, JavaScriptResultCallback>::iterator it = |
1041 javascript_callbacks_.find(id); | 1047 javascript_callbacks_.find(id); |
1042 if (it != javascript_callbacks_.end()) { | 1048 if (it != javascript_callbacks_.end()) { |
1043 it->second.Run(result_value); | 1049 it->second.Run(result_value); |
1044 javascript_callbacks_.erase(it); | 1050 javascript_callbacks_.erase(it); |
1045 } else { | 1051 } else { |
1046 NOTREACHED() << "Received script response for unknown request"; | 1052 NOTREACHED() << "Received script response for unknown request"; |
1047 } | 1053 } |
1048 } | 1054 } |
1049 | 1055 |
| 1056 void RenderFrameHostImpl::OnFlushVisualStateResponse(uint64 id) { |
| 1057 auto it = flush_visual_state_callbacks_.find(id); |
| 1058 if (it != flush_visual_state_callbacks_.end()) { |
| 1059 it->second.Run(true); |
| 1060 flush_visual_state_callbacks_.erase(it); |
| 1061 } else { |
| 1062 NOTREACHED() << "Received script response for unknown request"; |
| 1063 } |
| 1064 } |
| 1065 |
1050 void RenderFrameHostImpl::OnRunJavaScriptMessage( | 1066 void RenderFrameHostImpl::OnRunJavaScriptMessage( |
1051 const base::string16& message, | 1067 const base::string16& message, |
1052 const base::string16& default_prompt, | 1068 const base::string16& default_prompt, |
1053 const GURL& frame_url, | 1069 const GURL& frame_url, |
1054 JavaScriptMessageType type, | 1070 JavaScriptMessageType type, |
1055 IPC::Message* reply_msg) { | 1071 IPC::Message* reply_msg) { |
1056 // While a JS message dialog is showing, tabs in the same process shouldn't | 1072 // While a JS message dialog is showing, tabs in the same process shouldn't |
1057 // process input events. | 1073 // process input events. |
1058 GetProcess()->SetIgnoreInputEvents(true); | 1074 GetProcess()->SetIgnoreInputEvents(true); |
1059 render_view_host_->StopHangMonitorTimeout(); | 1075 render_view_host_->StopHangMonitorTimeout(); |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 int request_id) { | 1688 int request_id) { |
1673 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 1689 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
1674 if (accessibility_mode & AccessibilityModeFlagPlatform) { | 1690 if (accessibility_mode & AccessibilityModeFlagPlatform) { |
1675 BrowserAccessibilityManager* manager = | 1691 BrowserAccessibilityManager* manager = |
1676 GetOrCreateBrowserAccessibilityManager(); | 1692 GetOrCreateBrowserAccessibilityManager(); |
1677 if (manager) | 1693 if (manager) |
1678 manager->ActivateFindInPageResult(request_id); | 1694 manager->ActivateFindInPageResult(request_id); |
1679 } | 1695 } |
1680 } | 1696 } |
1681 | 1697 |
| 1698 void RenderFrameHostImpl::FlushVisualState( |
| 1699 const FlushVisualStateResultCallback& callback) { |
| 1700 static uint64 next_id = 1; |
| 1701 uint64 key = next_id++; |
| 1702 Send(new FrameMsg_FlushVisualStateRequest(routing_id_, key)); |
| 1703 flush_visual_state_callbacks_.insert(std::make_pair(key, callback)); |
| 1704 } |
| 1705 |
1682 #if defined(OS_WIN) | 1706 #if defined(OS_WIN) |
1683 | 1707 |
1684 void RenderFrameHostImpl::SetParentNativeViewAccessible( | 1708 void RenderFrameHostImpl::SetParentNativeViewAccessible( |
1685 gfx::NativeViewAccessible accessible_parent) { | 1709 gfx::NativeViewAccessible accessible_parent) { |
1686 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 1710 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( |
1687 render_view_host_->GetView()); | 1711 render_view_host_->GetView()); |
1688 if (view) | 1712 if (view) |
1689 view->SetParentNativeViewAccessible(accessible_parent); | 1713 view->SetParentNativeViewAccessible(accessible_parent); |
1690 } | 1714 } |
1691 | 1715 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1795 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1772 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1796 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1773 GetContentClient()->browser()->RegisterPermissionUsage( | 1797 GetContentClient()->browser()->RegisterPermissionUsage( |
1774 PERMISSION_GEOLOCATION, | 1798 PERMISSION_GEOLOCATION, |
1775 delegate_->GetAsWebContents(), | 1799 delegate_->GetAsWebContents(), |
1776 GetLastCommittedURL().GetOrigin(), | 1800 GetLastCommittedURL().GetOrigin(), |
1777 top_frame->GetLastCommittedURL().GetOrigin()); | 1801 top_frame->GetLastCommittedURL().GetOrigin()); |
1778 } | 1802 } |
1779 | 1803 |
1780 } // namespace content | 1804 } // namespace content |
OLD | NEW |