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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (IsRFHStateActive(rfh_state_)) | 172 if (IsRFHStateActive(rfh_state_)) |
173 GetSiteInstance()->decrement_active_frame_count(); | 173 GetSiteInstance()->decrement_active_frame_count(); |
174 | 174 |
175 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 175 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
176 // the corresponding RenderViewHost if it is no longer needed. | 176 // the corresponding RenderViewHost if it is no longer needed. |
177 frame_tree_->UnregisterRenderFrameHost(this); | 177 frame_tree_->UnregisterRenderFrameHost(this); |
178 | 178 |
179 // NULL out the swapout timer; in crash dumps this member will be null only if | 179 // NULL out the swapout timer; in crash dumps this member will be null only if |
180 // the dtor has run. | 180 // the dtor has run. |
181 swapout_event_monitor_timeout_.reset(); | 181 swapout_event_monitor_timeout_.reset(); |
| 182 |
| 183 for (const auto& iter: flush_visual_state_callbacks_) { |
| 184 iter.second.Run(false); |
| 185 } |
182 } | 186 } |
183 | 187 |
184 int RenderFrameHostImpl::GetRoutingID() { | 188 int RenderFrameHostImpl::GetRoutingID() { |
185 return routing_id_; | 189 return routing_id_; |
186 } | 190 } |
187 | 191 |
188 SiteInstanceImpl* RenderFrameHostImpl::GetSiteInstance() { | 192 SiteInstanceImpl* RenderFrameHostImpl::GetSiteInstance() { |
189 return render_view_host_->GetSiteInstance(); | 193 return render_view_host_->GetSiteInstance(); |
190 } | 194 } |
191 | 195 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 OnDidCommitProvisionalLoad(msg)) | 313 OnDidCommitProvisionalLoad(msg)) |
310 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) | 314 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDropNavigation, OnDidDropNavigation) |
311 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 315 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
312 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, | 316 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, |
313 OnDocumentOnLoadCompleted) | 317 OnDocumentOnLoadCompleted) |
314 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) | 318 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) |
315 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) | 319 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) |
316 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) | 320 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) |
317 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, | 321 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, |
318 OnJavaScriptExecuteResponse) | 322 OnJavaScriptExecuteResponse) |
| 323 IPC_MESSAGE_HANDLER(FrameHostMsg_FlushVisualStateResponse, |
| 324 OnFlushVisualStateResponse) |
319 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, | 325 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, |
320 OnRunJavaScriptMessage) | 326 OnRunJavaScriptMessage) |
321 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, | 327 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, |
322 OnRunBeforeUnloadConfirm) | 328 OnRunBeforeUnloadConfirm) |
323 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, | 329 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, |
324 OnDidAccessInitialDocument) | 330 OnDidAccessInitialDocument) |
325 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) | 331 IPC_MESSAGE_HANDLER(FrameHostMsg_DidDisownOpener, OnDidDisownOpener) |
326 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) | 332 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAssignPageId, OnDidAssignPageId) |
327 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) | 333 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateTitle, OnUpdateTitle) |
328 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) | 334 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateEncoding, OnUpdateEncoding) |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 std::map<int, JavaScriptResultCallback>::iterator it = | 943 std::map<int, JavaScriptResultCallback>::iterator it = |
938 javascript_callbacks_.find(id); | 944 javascript_callbacks_.find(id); |
939 if (it != javascript_callbacks_.end()) { | 945 if (it != javascript_callbacks_.end()) { |
940 it->second.Run(result_value); | 946 it->second.Run(result_value); |
941 javascript_callbacks_.erase(it); | 947 javascript_callbacks_.erase(it); |
942 } else { | 948 } else { |
943 NOTREACHED() << "Received script response for unknown request"; | 949 NOTREACHED() << "Received script response for unknown request"; |
944 } | 950 } |
945 } | 951 } |
946 | 952 |
| 953 void RenderFrameHostImpl::OnFlushVisualStateResponse(int id) { |
| 954 auto it = flush_visual_state_callbacks_.find(id); |
| 955 if (it != flush_visual_state_callbacks_.end()) { |
| 956 it->second.Run(true); |
| 957 flush_visual_state_callbacks_.erase(it); |
| 958 } else { |
| 959 NOTREACHED() << "Received script response for unknown request"; |
| 960 } |
| 961 } |
| 962 |
947 void RenderFrameHostImpl::OnRunJavaScriptMessage( | 963 void RenderFrameHostImpl::OnRunJavaScriptMessage( |
948 const base::string16& message, | 964 const base::string16& message, |
949 const base::string16& default_prompt, | 965 const base::string16& default_prompt, |
950 const GURL& frame_url, | 966 const GURL& frame_url, |
951 JavaScriptMessageType type, | 967 JavaScriptMessageType type, |
952 IPC::Message* reply_msg) { | 968 IPC::Message* reply_msg) { |
953 // While a JS message dialog is showing, tabs in the same process shouldn't | 969 // While a JS message dialog is showing, tabs in the same process shouldn't |
954 // process input events. | 970 // process input events. |
955 GetProcess()->SetIgnoreInputEvents(true); | 971 GetProcess()->SetIgnoreInputEvents(true); |
956 render_view_host_->StopHangMonitorTimeout(); | 972 render_view_host_->StopHangMonitorTimeout(); |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 int request_id) { | 1559 int request_id) { |
1544 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 1560 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
1545 if (accessibility_mode & AccessibilityModeFlagPlatform) { | 1561 if (accessibility_mode & AccessibilityModeFlagPlatform) { |
1546 BrowserAccessibilityManager* manager = | 1562 BrowserAccessibilityManager* manager = |
1547 GetOrCreateBrowserAccessibilityManager(); | 1563 GetOrCreateBrowserAccessibilityManager(); |
1548 if (manager) | 1564 if (manager) |
1549 manager->ActivateFindInPageResult(request_id); | 1565 manager->ActivateFindInPageResult(request_id); |
1550 } | 1566 } |
1551 } | 1567 } |
1552 | 1568 |
| 1569 void RenderFrameHostImpl::FlushVisualState( |
| 1570 const FlushVisualStateResultCallback& callback) { |
| 1571 static uint64 next_id = 1; |
| 1572 int key = next_id++; |
| 1573 Send(new FrameMsg_FlushVisualStateRequest(routing_id_, key)); |
| 1574 flush_visual_state_callbacks_.insert(std::make_pair(key, callback)); |
| 1575 } |
| 1576 |
1553 #if defined(OS_WIN) | 1577 #if defined(OS_WIN) |
1554 | 1578 |
1555 void RenderFrameHostImpl::SetParentNativeViewAccessible( | 1579 void RenderFrameHostImpl::SetParentNativeViewAccessible( |
1556 gfx::NativeViewAccessible accessible_parent) { | 1580 gfx::NativeViewAccessible accessible_parent) { |
1557 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 1581 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( |
1558 render_view_host_->GetView()); | 1582 render_view_host_->GetView()); |
1559 if (view) | 1583 if (view) |
1560 view->SetParentNativeViewAccessible(accessible_parent); | 1584 view->SetParentNativeViewAccessible(accessible_parent); |
1561 } | 1585 } |
1562 | 1586 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1666 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1643 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1667 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1644 GetContentClient()->browser()->RegisterPermissionUsage( | 1668 GetContentClient()->browser()->RegisterPermissionUsage( |
1645 PERMISSION_GEOLOCATION, | 1669 PERMISSION_GEOLOCATION, |
1646 delegate_->GetAsWebContents(), | 1670 delegate_->GetAsWebContents(), |
1647 GetLastCommittedURL().GetOrigin(), | 1671 GetLastCommittedURL().GetOrigin(), |
1648 top_frame->GetLastCommittedURL().GetOrigin()); | 1672 top_frame->GetLastCommittedURL().GetOrigin()); |
1649 } | 1673 } |
1650 | 1674 |
1651 } // namespace content | 1675 } // namespace content |
OLD | NEW |