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

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

Issue 2824193002: Enable use_once_callback for //content/common/*.mojom (Closed)
Patch Set: rebase Created 3 years, 7 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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id, 2433 void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id,
2434 WindowOpenDisposition disposition, 2434 WindowOpenDisposition disposition,
2435 const gfx::Rect& initial_rect, 2435 const gfx::Rect& initial_rect,
2436 bool user_gesture) { 2436 bool user_gesture) {
2437 delegate_->ShowCreatedWindow(GetProcess()->GetID(), pending_widget_routing_id, 2437 delegate_->ShowCreatedWindow(GetProcess()->GetID(), pending_widget_routing_id,
2438 disposition, initial_rect, user_gesture); 2438 disposition, initial_rect, user_gesture);
2439 } 2439 }
2440 2440
2441 void RenderFrameHostImpl::CreateNewWindow( 2441 void RenderFrameHostImpl::CreateNewWindow(
2442 mojom::CreateNewWindowParamsPtr params, 2442 mojom::CreateNewWindowParamsPtr params,
2443 const CreateNewWindowCallback& callback) { 2443 CreateNewWindowCallback callback) {
2444 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2444 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2445 2445
2446 bool no_javascript_access = false; 2446 bool no_javascript_access = false;
2447 2447
2448 // Filter out URLs that this process cannot request. 2448 // Filter out URLs that this process cannot request.
2449 GetProcess()->FilterURL(false, &params->target_url); 2449 GetProcess()->FilterURL(false, &params->target_url);
2450 2450
2451 // Ignore creation when sent from a frame that's not current or created. 2451 // Ignore creation when sent from a frame that's not current or created.
2452 bool can_create_window = 2452 bool can_create_window =
2453 frame_tree_node_->current_frame_host() == this && render_frame_created_ && 2453 frame_tree_node_->current_frame_host() == this && render_frame_created_ &&
2454 GetContentClient()->browser()->CanCreateWindow( 2454 GetContentClient()->browser()->CanCreateWindow(
2455 this, last_committed_url(), 2455 this, last_committed_url(),
2456 frame_tree_node_->frame_tree()->GetMainFrame()->last_committed_url(), 2456 frame_tree_node_->frame_tree()->GetMainFrame()->last_committed_url(),
2457 last_committed_origin_.GetURL(), params->window_container_type, 2457 last_committed_origin_.GetURL(), params->window_container_type,
2458 params->target_url, params->referrer, params->frame_name, 2458 params->target_url, params->referrer, params->frame_name,
2459 params->disposition, *params->features, params->user_gesture, 2459 params->disposition, *params->features, params->user_gesture,
2460 params->opener_suppressed, &no_javascript_access); 2460 params->opener_suppressed, &no_javascript_access);
2461 2461
2462 mojom::CreateNewWindowReplyPtr reply = mojom::CreateNewWindowReply::New(); 2462 mojom::CreateNewWindowReplyPtr reply = mojom::CreateNewWindowReply::New();
2463 if (!can_create_window) { 2463 if (!can_create_window) {
2464 RunCreateWindowCompleteCallback(callback, std::move(reply), 2464 RunCreateWindowCompleteCallback(std::move(callback), std::move(reply),
2465 MSG_ROUTING_NONE, MSG_ROUTING_NONE, 2465 MSG_ROUTING_NONE, MSG_ROUTING_NONE,
2466 MSG_ROUTING_NONE, 0); 2466 MSG_ROUTING_NONE, 0);
2467 return; 2467 return;
2468 } 2468 }
2469 2469
2470 // This will clone the sessionStorage for namespace_id_to_clone. 2470 // This will clone the sessionStorage for namespace_id_to_clone.
2471 2471
2472 StoragePartition* storage_partition = BrowserContext::GetStoragePartition( 2472 StoragePartition* storage_partition = BrowserContext::GetStoragePartition(
2473 GetSiteInstance()->GetBrowserContext(), GetSiteInstance()); 2473 GetSiteInstance()->GetBrowserContext(), GetSiteInstance());
2474 DOMStorageContextWrapper* dom_storage_context = 2474 DOMStorageContextWrapper* dom_storage_context =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 // If we did not create a WebContents to host the renderer-created 2520 // If we did not create a WebContents to host the renderer-created
2521 // RenderFrame/RenderView/RenderWidget objects, make sure to send invalid 2521 // RenderFrame/RenderView/RenderWidget objects, make sure to send invalid
2522 // routing ids back to the renderer. 2522 // routing ids back to the renderer.
2523 if (main_frame_route_id != MSG_ROUTING_NONE) { 2523 if (main_frame_route_id != MSG_ROUTING_NONE) {
2524 bool succeeded = 2524 bool succeeded =
2525 RenderWidgetHost::FromID(render_process_id, 2525 RenderWidgetHost::FromID(render_process_id,
2526 main_frame_widget_route_id) != nullptr; 2526 main_frame_widget_route_id) != nullptr;
2527 if (!succeeded) { 2527 if (!succeeded) {
2528 DCHECK(!RenderFrameHost::FromID(render_process_id, main_frame_route_id)); 2528 DCHECK(!RenderFrameHost::FromID(render_process_id, main_frame_route_id));
2529 DCHECK(!RenderViewHost::FromID(render_process_id, render_view_route_id)); 2529 DCHECK(!RenderViewHost::FromID(render_process_id, render_view_route_id));
2530 RunCreateWindowCompleteCallback(callback, std::move(reply), 2530 RunCreateWindowCompleteCallback(std::move(callback), std::move(reply),
2531 MSG_ROUTING_NONE, MSG_ROUTING_NONE, 2531 MSG_ROUTING_NONE, MSG_ROUTING_NONE,
2532 MSG_ROUTING_NONE, 0); 2532 MSG_ROUTING_NONE, 0);
2533 return; 2533 return;
2534 } 2534 }
2535 DCHECK(RenderFrameHost::FromID(render_process_id, main_frame_route_id)); 2535 DCHECK(RenderFrameHost::FromID(render_process_id, main_frame_route_id));
2536 DCHECK(RenderViewHost::FromID(render_process_id, render_view_route_id)); 2536 DCHECK(RenderViewHost::FromID(render_process_id, render_view_route_id));
2537 } 2537 }
2538 2538
2539 RunCreateWindowCompleteCallback( 2539 RunCreateWindowCompleteCallback(
2540 callback, std::move(reply), render_view_route_id, main_frame_route_id, 2540 std::move(callback), std::move(reply), render_view_route_id,
2541 main_frame_widget_route_id, cloned_namespace->id()); 2541 main_frame_route_id, main_frame_widget_route_id, cloned_namespace->id());
2542 } 2542 }
2543 2543
2544 void RenderFrameHostImpl::RunCreateWindowCompleteCallback( 2544 void RenderFrameHostImpl::RunCreateWindowCompleteCallback(
2545 const CreateNewWindowCallback& callback, 2545 CreateNewWindowCallback callback,
2546 mojom::CreateNewWindowReplyPtr reply, 2546 mojom::CreateNewWindowReplyPtr reply,
2547 int render_view_route_id, 2547 int render_view_route_id,
2548 int main_frame_route_id, 2548 int main_frame_route_id,
2549 int main_frame_widget_route_id, 2549 int main_frame_widget_route_id,
2550 int cloned_session_storage_namespace_id) { 2550 int cloned_session_storage_namespace_id) {
2551 reply->route_id = render_view_route_id; 2551 reply->route_id = render_view_route_id;
2552 reply->main_frame_route_id = main_frame_route_id; 2552 reply->main_frame_route_id = main_frame_route_id;
2553 reply->main_frame_widget_route_id = main_frame_widget_route_id; 2553 reply->main_frame_widget_route_id = main_frame_widget_route_id;
2554 reply->cloned_session_storage_namespace_id = 2554 reply->cloned_session_storage_namespace_id =
2555 cloned_session_storage_namespace_id; 2555 cloned_session_storage_namespace_id;
2556 callback.Run(std::move(reply)); 2556 std::move(callback).Run(std::move(reply));
2557 } 2557 }
2558 2558
2559 void RenderFrameHostImpl::RegisterMojoInterfaces() { 2559 void RenderFrameHostImpl::RegisterMojoInterfaces() {
2560 device::GeolocationServiceContext* geolocation_service_context = 2560 device::GeolocationServiceContext* geolocation_service_context =
2561 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; 2561 delegate_ ? delegate_->GetGeolocationServiceContext() : NULL;
2562 2562
2563 #if !defined(OS_ANDROID) 2563 #if !defined(OS_ANDROID)
2564 // The default (no-op) implementation of InstalledAppProvider. On Android, the 2564 // The default (no-op) implementation of InstalledAppProvider. On Android, the
2565 // real implementation is provided in Java. 2565 // real implementation is provided in Java.
2566 GetInterfaceRegistry()->AddInterface( 2566 GetInterfaceRegistry()->AddInterface(
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 } 3786 }
3787 3787
3788 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3788 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3789 const std::string& interface_name, 3789 const std::string& interface_name,
3790 mojo::ScopedMessagePipeHandle pipe) { 3790 mojo::ScopedMessagePipeHandle pipe) {
3791 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3791 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3792 } 3792 }
3793 #endif 3793 #endif
3794 3794
3795 } // namespace content 3795 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/frame_host/render_frame_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698