Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/browser_navigator.h" | 5 #include "chrome/browser/ui/browser_navigator.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 if (params->source_contents) { | 250 if (params->source_contents) { |
| 251 return Profile::FromBrowserContext( | 251 return Profile::FromBrowserContext( |
| 252 params->source_contents->GetBrowserContext()); | 252 params->source_contents->GetBrowserContext()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 return params->initiating_profile; | 255 return params->initiating_profile; |
| 256 } | 256 } |
| 257 | 257 |
| 258 void LoadURLInContents(WebContents* target_contents, | 258 void LoadURLInContents(WebContents* target_contents, |
| 259 const GURL& url, | 259 const GURL& url, |
| 260 content::SiteInstance* site_instance, | |
|
Charlie Reis
2014/11/20 19:58:43
Isn't this already in |params|?
lfg
2014/12/05 21:55:42
Yep. Removed.
| |
| 260 chrome::NavigateParams* params) { | 261 chrome::NavigateParams* params) { |
| 261 NavigationController::LoadURLParams load_url_params(url); | 262 NavigationController::LoadURLParams load_url_params(url); |
| 263 load_url_params.site_instance = site_instance; | |
| 262 load_url_params.referrer = params->referrer; | 264 load_url_params.referrer = params->referrer; |
| 263 load_url_params.frame_tree_node_id = params->frame_tree_node_id; | 265 load_url_params.frame_tree_node_id = params->frame_tree_node_id; |
| 264 load_url_params.redirect_chain = params->redirect_chain; | 266 load_url_params.redirect_chain = params->redirect_chain; |
| 265 load_url_params.transition_type = params->transition; | 267 load_url_params.transition_type = params->transition; |
| 266 load_url_params.extra_headers = params->extra_headers; | 268 load_url_params.extra_headers = params->extra_headers; |
| 267 load_url_params.should_replace_current_entry = | 269 load_url_params.should_replace_current_entry = |
| 268 params->should_replace_current_entry; | 270 params->should_replace_current_entry; |
| 269 | 271 |
| 270 if (params->transferred_global_request_id != GlobalRequestID()) { | 272 if (params->transferred_global_request_id != GlobalRequestID()) { |
| 271 load_url_params.is_renderer_initiated = params->is_renderer_initiated; | 273 load_url_params.is_renderer_initiated = params->is_renderer_initiated; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 host_desktop_type(chrome::GetActiveDesktop()), | 480 host_desktop_type(chrome::GetActiveDesktop()), |
| 479 should_replace_current_entry(false), | 481 should_replace_current_entry(false), |
| 480 should_set_opener(false) { | 482 should_set_opener(false) { |
| 481 } | 483 } |
| 482 | 484 |
| 483 NavigateParams::~NavigateParams() {} | 485 NavigateParams::~NavigateParams() {} |
| 484 | 486 |
| 485 void FillNavigateParamsFromOpenURLParams(chrome::NavigateParams* nav_params, | 487 void FillNavigateParamsFromOpenURLParams(chrome::NavigateParams* nav_params, |
| 486 const content::OpenURLParams& params) { | 488 const content::OpenURLParams& params) { |
| 487 nav_params->referrer = params.referrer; | 489 nav_params->referrer = params.referrer; |
| 490 nav_params->site_instance = params.site_instance; | |
| 488 nav_params->frame_tree_node_id = params.frame_tree_node_id; | 491 nav_params->frame_tree_node_id = params.frame_tree_node_id; |
| 489 nav_params->redirect_chain = params.redirect_chain; | 492 nav_params->redirect_chain = params.redirect_chain; |
| 490 nav_params->extra_headers = params.extra_headers; | 493 nav_params->extra_headers = params.extra_headers; |
| 491 nav_params->disposition = params.disposition; | 494 nav_params->disposition = params.disposition; |
| 492 nav_params->trusted_source = false; | 495 nav_params->trusted_source = false; |
| 493 nav_params->is_renderer_initiated = params.is_renderer_initiated; | 496 nav_params->is_renderer_initiated = params.is_renderer_initiated; |
| 494 nav_params->transferred_global_request_id = | 497 nav_params->transferred_global_request_id = |
| 495 params.transferred_global_request_id; | 498 params.transferred_global_request_id; |
| 496 nav_params->should_replace_current_entry = | 499 nav_params->should_replace_current_entry = |
| 497 params.should_replace_current_entry; | 500 params.should_replace_current_entry; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 if (user_initiated) | 637 if (user_initiated) |
| 635 params->target_contents->UserGestureDone(); | 638 params->target_contents->UserGestureDone(); |
| 636 | 639 |
| 637 if (!swapped_in_prerender) { | 640 if (!swapped_in_prerender) { |
| 638 // Try to handle non-navigational URLs that popup dialogs and such, these | 641 // Try to handle non-navigational URLs that popup dialogs and such, these |
| 639 // should not actually navigate. | 642 // should not actually navigate. |
| 640 if (!HandleNonNavigationAboutURL(params->url)) { | 643 if (!HandleNonNavigationAboutURL(params->url)) { |
| 641 // Perform the actual navigation, tracking whether it came from the | 644 // Perform the actual navigation, tracking whether it came from the |
| 642 // renderer. | 645 // renderer. |
| 643 | 646 |
| 644 LoadURLInContents(params->target_contents, params->url, params); | 647 LoadURLInContents(params->target_contents, params->url, |
| 648 params->site_instance.get(), params); | |
| 645 // For prerender bookkeeping purposes, record that this pending navigate | 649 // For prerender bookkeeping purposes, record that this pending navigate |
| 646 // originated from chrome::Navigate. | 650 // originated from chrome::Navigate. |
| 647 content::NavigationEntry* entry = | 651 content::NavigationEntry* entry = |
| 648 params->target_contents->GetController().GetPendingEntry(); | 652 params->target_contents->GetController().GetPendingEntry(); |
| 649 if (entry) | 653 if (entry) |
| 650 entry->SetExtraData(prerender::kChromeNavigateExtraDataKey, | 654 entry->SetExtraData(prerender::kChromeNavigateExtraDataKey, |
| 651 base::string16()); | 655 base::string16()); |
| 652 } | 656 } |
| 653 } | 657 } |
| 654 } else { | 658 } else { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 } | 694 } |
| 691 | 695 |
| 692 if (singleton_index >= 0) { | 696 if (singleton_index >= 0) { |
| 693 WebContents* target = | 697 WebContents* target = |
| 694 params->browser->tab_strip_model()->GetWebContentsAt(singleton_index); | 698 params->browser->tab_strip_model()->GetWebContentsAt(singleton_index); |
| 695 | 699 |
| 696 if (target->IsCrashed()) { | 700 if (target->IsCrashed()) { |
| 697 target->GetController().Reload(true); | 701 target->GetController().Reload(true); |
| 698 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && | 702 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && |
| 699 target->GetURL() != params->url) { | 703 target->GetURL() != params->url) { |
| 700 LoadURLInContents(target, params->url, params); | 704 LoadURLInContents(target, params->url, params->site_instance.get(), |
| 705 params); | |
| 701 // For prerender bookkeeping purposes, record that this pending navigate | 706 // For prerender bookkeeping purposes, record that this pending navigate |
| 702 // originated from chrome::Navigate. | 707 // originated from chrome::Navigate. |
| 703 content::NavigationEntry* entry = | 708 content::NavigationEntry* entry = |
| 704 target->GetController().GetPendingEntry(); | 709 target->GetController().GetPendingEntry(); |
| 705 if (entry) | 710 if (entry) |
| 706 entry->SetExtraData(prerender::kChromeNavigateExtraDataKey, | 711 entry->SetExtraData(prerender::kChromeNavigateExtraDataKey, |
| 707 base::string16()); | 712 base::string16()); |
| 708 } | 713 } |
| 709 | 714 |
| 710 // If the singleton tab isn't already selected, select it. | 715 // If the singleton tab isn't already selected, select it. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 769 bool reverse_on_redirect = false; | 774 bool reverse_on_redirect = false; |
| 770 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 775 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 771 &rewritten_url, browser_context, &reverse_on_redirect); | 776 &rewritten_url, browser_context, &reverse_on_redirect); |
| 772 | 777 |
| 773 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 778 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 774 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 779 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
| 775 rewritten_url.host() == chrome::kChromeUIUberHost); | 780 rewritten_url.host() == chrome::kChromeUIUberHost); |
| 776 } | 781 } |
| 777 | 782 |
| 778 } // namespace chrome | 783 } // namespace chrome |
| OLD | NEW |