| 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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "content/browser/frame_host/frame_tree.h" | 9 #include "content/browser/frame_host/frame_tree.h" |
| 10 #include "content/browser/frame_host/frame_tree_node.h" | 10 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 << " characters."; | 335 << " characters."; |
| 336 return false; | 336 return false; |
| 337 } | 337 } |
| 338 | 338 |
| 339 // This will be used to set the Navigation Timing API navigationStart | 339 // This will be used to set the Navigation Timing API navigationStart |
| 340 // parameter for browser navigations in new tabs (intents, tabs opened through | 340 // parameter for browser navigations in new tabs (intents, tabs opened through |
| 341 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to | 341 // "Open link in new tab"). We need to keep it above RFHM::Navigate() call to |
| 342 // capture the time needed for the RenderFrameHost initialization. | 342 // capture the time needed for the RenderFrameHost initialization. |
| 343 base::TimeTicks navigation_start = base::TimeTicks::Now(); | 343 base::TimeTicks navigation_start = base::TimeTicks::Now(); |
| 344 | 344 |
| 345 // Create the navigation parameters. | |
| 346 FrameMsg_Navigate_Params navigate_params; | 345 FrameMsg_Navigate_Params navigate_params; |
| 347 MakeNavigateParams( | |
| 348 entry, *controller_, reload_type, navigation_start, &navigate_params); | |
| 349 | |
| 350 RenderFrameHostManager* manager = | 346 RenderFrameHostManager* manager = |
| 351 render_frame_host->frame_tree_node()->render_manager(); | 347 render_frame_host->frame_tree_node()->render_manager(); |
| 352 | 348 |
| 353 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. Instead | 349 // PlzNavigate: the RenderFrameHosts are no longer asked to navigate. Instead |
| 354 // the RenderFrameHostManager handles the navigation requests for that frame | 350 // the RenderFrameHostManager handles the navigation requests for that frame |
| 355 // node. | 351 // node. |
| 356 if (CommandLine::ForCurrentProcess()->HasSwitch( | 352 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 357 switches::kEnableBrowserSideNavigation)) { | 353 switches::kEnableBrowserSideNavigation)) { |
| 354 // Create the navigation parameters. |
| 355 MakeNavigateParams( |
| 356 entry, *controller_, reload_type, navigation_start, &navigate_params); |
| 358 return manager->RequestNavigation(entry, navigate_params); | 357 return manager->RequestNavigation(entry, navigate_params); |
| 359 } | 358 } |
| 360 | 359 |
| 361 RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); | 360 RenderFrameHostImpl* dest_render_frame_host = manager->Navigate(entry); |
| 362 if (!dest_render_frame_host) | 361 if (!dest_render_frame_host) |
| 363 return false; // Unable to create the desired RenderFrameHost. | 362 return false; // Unable to create the desired RenderFrameHost. |
| 364 | 363 |
| 365 // Make sure no code called via RFHM::Navigate clears the pending entry. | 364 // Make sure no code called via RFHM::Navigate clears the pending entry. |
| 366 CHECK_EQ(controller_->GetPendingEntry(), &entry); | 365 CHECK_EQ(controller_->GetPendingEntry(), &entry); |
| 367 | 366 |
| 368 // For security, we should never send non-Web-UI URLs to a Web UI renderer. | 367 // For security, we should never send non-Web-UI URLs to a Web UI renderer. |
| 369 // Double check that here. | 368 // Double check that here. |
| 370 CheckWebUIRendererDoesNotDisplayNormalURL( | 369 CheckWebUIRendererDoesNotDisplayNormalURL( |
| 371 dest_render_frame_host, entry.GetURL()); | 370 dest_render_frame_host, entry.GetURL()); |
| 372 | 371 |
| 373 // Notify observers that we will navigate in this RenderFrame. | 372 // Notify observers that we will navigate in this RenderFrame. |
| 374 if (delegate_) | 373 if (delegate_) |
| 375 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host); | 374 delegate_->AboutToNavigateRenderFrame(dest_render_frame_host); |
| 376 | 375 |
| 376 // Create the navigation parameters. |
| 377 // TODO(vitalybuka): Move this before AboutToNavigateRenderFrame once |
| 378 // http://crbug.com/408684 is fixed. |
| 379 MakeNavigateParams( |
| 380 entry, *controller_, reload_type, navigation_start, &navigate_params); |
| 381 |
| 377 // Navigate in the desired RenderFrameHost. | 382 // Navigate in the desired RenderFrameHost. |
| 378 // We can skip this step in the rare case that this is a transfer navigation | 383 // We can skip this step in the rare case that this is a transfer navigation |
| 379 // which began in the chosen RenderFrameHost, since the request has already | 384 // which began in the chosen RenderFrameHost, since the request has already |
| 380 // been issued. In that case, simply resume the response. | 385 // been issued. In that case, simply resume the response. |
| 381 bool is_transfer_to_same = | 386 bool is_transfer_to_same = |
| 382 navigate_params.transferred_request_child_id != -1 && | 387 navigate_params.transferred_request_child_id != -1 && |
| 383 navigate_params.transferred_request_child_id == | 388 navigate_params.transferred_request_child_id == |
| 384 dest_render_frame_host->GetProcess()->GetID(); | 389 dest_render_frame_host->GetProcess()->GetID(); |
| 385 if (!is_transfer_to_same) { | 390 if (!is_transfer_to_same) { |
| 386 dest_render_frame_host->Navigate(navigate_params); | 391 dest_render_frame_host->Navigate(navigate_params); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 controller_->GetBrowserContext(), url); | 676 controller_->GetBrowserContext(), url); |
| 672 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && | 677 if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && |
| 673 !is_allowed_in_web_ui_renderer) { | 678 !is_allowed_in_web_ui_renderer) { |
| 674 // Log the URL to help us diagnose any future failures of this CHECK. | 679 // Log the URL to help us diagnose any future failures of this CHECK. |
| 675 GetContentClient()->SetActiveURL(url); | 680 GetContentClient()->SetActiveURL(url); |
| 676 CHECK(0); | 681 CHECK(0); |
| 677 } | 682 } |
| 678 } | 683 } |
| 679 | 684 |
| 680 } // namespace content | 685 } // namespace content |
| OLD | NEW |