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_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (dest_render_frame_host != render_frame_host_ && | 398 if (dest_render_frame_host != render_frame_host_ && |
399 !render_frame_host_->IsRenderFrameLive()) { | 399 !render_frame_host_->IsRenderFrameLive()) { |
400 // Note: we don't call InitRenderView here because we are navigating away | 400 // Note: we don't call InitRenderView here because we are navigating away |
401 // soon anyway, and we don't have the NavigationEntry for this host. | 401 // soon anyway, and we don't have the NavigationEntry for this host. |
402 delegate_->CreateRenderViewForRenderManager( | 402 delegate_->CreateRenderViewForRenderManager( |
403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, | 403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, |
404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(), | 404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(), |
405 frame_tree_node_->IsMainFrame()); | 405 frame_tree_node_->IsMainFrame()); |
406 } | 406 } |
407 | 407 |
408 // If the renderer crashed, then try to create a new one to satisfy this | 408 // If the renderer isn't live, then try to create a new one to satisfy this |
409 // navigation request. | 409 // navigation request. |
410 if (!dest_render_frame_host->IsRenderFrameLive()) { | 410 if (!dest_render_frame_host->IsRenderFrameLive()) { |
411 // Instruct the destination render frame host to set up a Mojo connection | 411 // Instruct the destination render frame host to set up a Mojo connection |
412 // with the new render frame if necessary. Note that this call needs to | 412 // with the new render frame if necessary. Note that this call needs to |
413 // occur before initializing the RenderView; the flow of creating the | 413 // occur before initializing the RenderView; the flow of creating the |
414 // RenderView can cause browser-side code to execute that expects the this | 414 // RenderView can cause browser-side code to execute that expects the this |
415 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI | 415 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI |
416 // site that is handled via Mojo, then Mojo WebUI code in //chrome will | 416 // site that is handled via Mojo, then Mojo WebUI code in //chrome will |
417 // add a service to this RFH's ServiceRegistry). | 417 // add a service to this RFH's ServiceRegistry). |
418 dest_render_frame_host->SetUpMojoIfNeeded(); | 418 dest_render_frame_host->SetUpMojoIfNeeded(); |
419 | 419 |
420 // Recreate the opener chain. | 420 // Recreate the opener chain. |
421 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(), | 421 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(), |
422 frame_tree_node_); | 422 frame_tree_node_); |
423 if (!InitRenderView(dest_render_frame_host->render_view_host(), | 423 if (!InitRenderView(dest_render_frame_host->render_view_host(), |
424 MSG_ROUTING_NONE, | 424 MSG_ROUTING_NONE, |
425 frame_tree_node_->IsMainFrame())) | 425 frame_tree_node_->IsMainFrame())) |
426 return nullptr; | 426 return nullptr; |
427 | 427 |
428 // Now that we've created a new renderer, be sure to hide it if it isn't | 428 // Now that we've created a new renderer, be sure to hide it if it isn't |
429 // our primary one. Otherwise, we might crash if we try to call Show() | 429 // our primary one. Otherwise, we might crash if we try to call Show() |
430 // on it later. | 430 // on it later. |
431 if (dest_render_frame_host != render_frame_host_) { | 431 if (dest_render_frame_host != render_frame_host_) { |
432 if (dest_render_frame_host->GetView()) | 432 if (dest_render_frame_host->GetView()) |
433 dest_render_frame_host->GetView()->Hide(); | 433 dest_render_frame_host->GetView()->Hide(); |
434 } else { | 434 } else { |
| 435 // After a renderer crash we'd have marked the host as invisible, so we |
| 436 // need to set the visibility of the new View to the correct value here |
| 437 // after reload. |
| 438 if (dest_render_frame_host->GetView() && |
| 439 dest_render_frame_host->render_view_host()->is_hidden() != |
| 440 delegate_->IsHidden()) { |
| 441 if (delegate_->IsHidden()) { |
| 442 dest_render_frame_host->GetView()->Hide(); |
| 443 } else { |
| 444 dest_render_frame_host->GetView()->Show(); |
| 445 } |
| 446 } |
| 447 |
435 // TODO(nasko): This is a very ugly hack. The Chrome extensions process | 448 // TODO(nasko): This is a very ugly hack. The Chrome extensions process |
436 // manager still uses NotificationService and expects to see a | 449 // manager still uses NotificationService and expects to see a |
437 // RenderViewHost changed notification after WebContents and | 450 // RenderViewHost changed notification after WebContents and |
438 // RenderFrameHostManager are completely initialized. This should be | 451 // RenderFrameHostManager are completely initialized. This should be |
439 // removed once the process manager moves away from NotificationService. | 452 // removed once the process manager moves away from NotificationService. |
440 // See https://crbug.com/462682. | 453 // See https://crbug.com/462682. |
441 delegate_->NotifyMainFrameSwappedFromRenderManager( | 454 delegate_->NotifyMainFrameSwappedFromRenderManager( |
442 nullptr, render_frame_host_->render_view_host()); | 455 nullptr, render_frame_host_->render_view_host()); |
443 } | 456 } |
444 } | 457 } |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2575 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2588 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2576 if (!frame_tree_node_->opener()) | 2589 if (!frame_tree_node_->opener()) |
2577 return MSG_ROUTING_NONE; | 2590 return MSG_ROUTING_NONE; |
2578 | 2591 |
2579 return frame_tree_node_->opener() | 2592 return frame_tree_node_->opener() |
2580 ->render_manager() | 2593 ->render_manager() |
2581 ->GetRoutingIdForSiteInstance(instance); | 2594 ->GetRoutingIdForSiteInstance(instance); |
2582 } | 2595 } |
2583 | 2596 |
2584 } // namespace content | 2597 } // namespace content |
OLD | NEW |