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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
926 std::map<int, JavaScriptResultCallback>::iterator it = | 932 std::map<int, JavaScriptResultCallback>::iterator it = |
927 javascript_callbacks_.find(id); | 933 javascript_callbacks_.find(id); |
928 if (it != javascript_callbacks_.end()) { | 934 if (it != javascript_callbacks_.end()) { |
929 it->second.Run(result_value); | 935 it->second.Run(result_value); |
930 javascript_callbacks_.erase(it); | 936 javascript_callbacks_.erase(it); |
931 } else { | 937 } else { |
932 NOTREACHED() << "Received script response for unknown request"; | 938 NOTREACHED() << "Received script response for unknown request"; |
933 } | 939 } |
934 } | 940 } |
935 | 941 |
942 void RenderFrameHostImpl::OnFlushVisualStateResponse(int id) { | |
943 auto it = flush_visual_state_callbacks_.find(id); | |
944 if (it != flush_visual_state_callbacks_.end()) { | |
945 it->second.Run(true); | |
946 flush_visual_state_callbacks_.erase(it); | |
947 } else { | |
948 NOTREACHED() << "Received script response for unknown request"; | |
949 } | |
950 } | |
951 | |
936 void RenderFrameHostImpl::OnRunJavaScriptMessage( | 952 void RenderFrameHostImpl::OnRunJavaScriptMessage( |
937 const base::string16& message, | 953 const base::string16& message, |
938 const base::string16& default_prompt, | 954 const base::string16& default_prompt, |
939 const GURL& frame_url, | 955 const GURL& frame_url, |
940 JavaScriptMessageType type, | 956 JavaScriptMessageType type, |
941 IPC::Message* reply_msg) { | 957 IPC::Message* reply_msg) { |
942 // While a JS message dialog is showing, tabs in the same process shouldn't | 958 // While a JS message dialog is showing, tabs in the same process shouldn't |
943 // process input events. | 959 // process input events. |
944 GetProcess()->SetIgnoreInputEvents(true); | 960 GetProcess()->SetIgnoreInputEvents(true); |
945 render_view_host_->StopHangMonitorTimeout(); | 961 render_view_host_->StopHangMonitorTimeout(); |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1509 int request_id) { | 1525 int request_id) { |
1510 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 1526 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
1511 if (accessibility_mode & AccessibilityModeFlagPlatform) { | 1527 if (accessibility_mode & AccessibilityModeFlagPlatform) { |
1512 BrowserAccessibilityManager* manager = | 1528 BrowserAccessibilityManager* manager = |
1513 GetOrCreateBrowserAccessibilityManager(); | 1529 GetOrCreateBrowserAccessibilityManager(); |
1514 if (manager) | 1530 if (manager) |
1515 manager->ActivateFindInPageResult(request_id); | 1531 manager->ActivateFindInPageResult(request_id); |
1516 } | 1532 } |
1517 } | 1533 } |
1518 | 1534 |
1535 void RenderFrameHostImpl::FlushVisualState( | |
1536 const FlushVisualStateResultCallback& callback) { | |
1537 static int next_id = 1; | |
mkosiba (inactive)
2015/01/14 18:17:12
or maybe uint64 to be extra safe :P
Ignacio Solla
2015/01/16 16:02:07
Done.
| |
1538 int key = next_id++; | |
1539 Send(new FrameMsg_FlushVisualStateRequest(routing_id_, key)); | |
1540 flush_visual_state_callbacks_.insert(std::make_pair(key, callback)); | |
1541 } | |
1542 | |
1519 #if defined(OS_WIN) | 1543 #if defined(OS_WIN) |
1520 | 1544 |
1521 void RenderFrameHostImpl::SetParentNativeViewAccessible( | 1545 void RenderFrameHostImpl::SetParentNativeViewAccessible( |
1522 gfx::NativeViewAccessible accessible_parent) { | 1546 gfx::NativeViewAccessible accessible_parent) { |
1523 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 1547 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( |
1524 render_view_host_->GetView()); | 1548 render_view_host_->GetView()); |
1525 if (view) | 1549 if (view) |
1526 view->SetParentNativeViewAccessible(accessible_parent); | 1550 view->SetParentNativeViewAccessible(accessible_parent); |
1527 } | 1551 } |
1528 | 1552 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1608 void RenderFrameHostImpl::DidUseGeolocationPermission() { | 1632 void RenderFrameHostImpl::DidUseGeolocationPermission() { |
1609 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); | 1633 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); |
1610 GetContentClient()->browser()->RegisterPermissionUsage( | 1634 GetContentClient()->browser()->RegisterPermissionUsage( |
1611 PERMISSION_GEOLOCATION, | 1635 PERMISSION_GEOLOCATION, |
1612 delegate_->GetAsWebContents(), | 1636 delegate_->GetAsWebContents(), |
1613 GetLastCommittedURL().GetOrigin(), | 1637 GetLastCommittedURL().GetOrigin(), |
1614 top_frame->GetLastCommittedURL().GetOrigin()); | 1638 top_frame->GetLastCommittedURL().GetOrigin()); |
1615 } | 1639 } |
1616 | 1640 |
1617 } // namespace content | 1641 } // namespace content |
OLD | NEW |