Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 831903004: [WebView] Add a new flushVisualState API to AwContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_) {
mkosiba (inactive) 2015/01/19 11:15:58 IIRC clang-format says no space before the :
Ignacio Solla 2015/01/19 18:26:41 Done.
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
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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 std::map<int, JavaScriptResultCallback>::iterator it = 938 std::map<int, JavaScriptResultCallback>::iterator it =
933 javascript_callbacks_.find(id); 939 javascript_callbacks_.find(id);
934 if (it != javascript_callbacks_.end()) { 940 if (it != javascript_callbacks_.end()) {
935 it->second.Run(result_value); 941 it->second.Run(result_value);
936 javascript_callbacks_.erase(it); 942 javascript_callbacks_.erase(it);
937 } else { 943 } else {
938 NOTREACHED() << "Received script response for unknown request"; 944 NOTREACHED() << "Received script response for unknown request";
939 } 945 }
940 } 946 }
941 947
948 void RenderFrameHostImpl::OnFlushVisualStateResponse(int id) {
949 auto it = flush_visual_state_callbacks_.find(id);
950 if (it != flush_visual_state_callbacks_.end()) {
951 it->second.Run(true);
952 flush_visual_state_callbacks_.erase(it);
953 } else {
954 NOTREACHED() << "Received script response for unknown request";
955 }
956 }
957
942 void RenderFrameHostImpl::OnRunJavaScriptMessage( 958 void RenderFrameHostImpl::OnRunJavaScriptMessage(
943 const base::string16& message, 959 const base::string16& message,
944 const base::string16& default_prompt, 960 const base::string16& default_prompt,
945 const GURL& frame_url, 961 const GURL& frame_url,
946 JavaScriptMessageType type, 962 JavaScriptMessageType type,
947 IPC::Message* reply_msg) { 963 IPC::Message* reply_msg) {
948 // While a JS message dialog is showing, tabs in the same process shouldn't 964 // While a JS message dialog is showing, tabs in the same process shouldn't
949 // process input events. 965 // process input events.
950 GetProcess()->SetIgnoreInputEvents(true); 966 GetProcess()->SetIgnoreInputEvents(true);
951 render_view_host_->StopHangMonitorTimeout(); 967 render_view_host_->StopHangMonitorTimeout();
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 int request_id) { 1535 int request_id) {
1520 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); 1536 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode();
1521 if (accessibility_mode & AccessibilityModeFlagPlatform) { 1537 if (accessibility_mode & AccessibilityModeFlagPlatform) {
1522 BrowserAccessibilityManager* manager = 1538 BrowserAccessibilityManager* manager =
1523 GetOrCreateBrowserAccessibilityManager(); 1539 GetOrCreateBrowserAccessibilityManager();
1524 if (manager) 1540 if (manager)
1525 manager->ActivateFindInPageResult(request_id); 1541 manager->ActivateFindInPageResult(request_id);
1526 } 1542 }
1527 } 1543 }
1528 1544
1545 void RenderFrameHostImpl::FlushVisualState(
1546 const FlushVisualStateResultCallback& callback) {
1547 static uint64 next_id = 1;
1548 int key = next_id++;
1549 Send(new FrameMsg_FlushVisualStateRequest(routing_id_, key));
1550 flush_visual_state_callbacks_.insert(std::make_pair(key, callback));
1551 }
1552
1529 #if defined(OS_WIN) 1553 #if defined(OS_WIN)
1530 1554
1531 void RenderFrameHostImpl::SetParentNativeViewAccessible( 1555 void RenderFrameHostImpl::SetParentNativeViewAccessible(
1532 gfx::NativeViewAccessible accessible_parent) { 1556 gfx::NativeViewAccessible accessible_parent) {
1533 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( 1557 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>(
1534 render_view_host_->GetView()); 1558 render_view_host_->GetView());
1535 if (view) 1559 if (view)
1536 view->SetParentNativeViewAccessible(accessible_parent); 1560 view->SetParentNativeViewAccessible(accessible_parent);
1537 } 1561 }
1538 1562
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 void RenderFrameHostImpl::DidUseGeolocationPermission() { 1642 void RenderFrameHostImpl::DidUseGeolocationPermission() {
1619 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame(); 1643 RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
1620 GetContentClient()->browser()->RegisterPermissionUsage( 1644 GetContentClient()->browser()->RegisterPermissionUsage(
1621 PERMISSION_GEOLOCATION, 1645 PERMISSION_GEOLOCATION,
1622 delegate_->GetAsWebContents(), 1646 delegate_->GetAsWebContents(),
1623 GetLastCommittedURL().GetOrigin(), 1647 GetLastCommittedURL().GetOrigin(),
1624 top_frame->GetLastCommittedURL().GetOrigin()); 1648 top_frame->GetLastCommittedURL().GetOrigin());
1625 } 1649 }
1626 1650
1627 } // namespace content 1651 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698