OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 } | 492 } |
493 | 493 |
494 InitializeExtraHeaders(params, params->target_contents->profile(), | 494 InitializeExtraHeaders(params, params->target_contents->profile(), |
495 &extra_headers); | 495 &extra_headers); |
496 | 496 |
497 // Try to handle non-navigational URLs that popup dialogs and such, these | 497 // Try to handle non-navigational URLs that popup dialogs and such, these |
498 // should not actually navigate. | 498 // should not actually navigate. |
499 if (!HandleNonNavigationAboutURL(url)) { | 499 if (!HandleNonNavigationAboutURL(url)) { |
500 // Perform the actual navigation, tracking whether it came from the | 500 // Perform the actual navigation, tracking whether it came from the |
501 // renderer. | 501 // renderer. |
502 if (params->is_renderer_initiated) { | 502 |
503 if (params->transferred_global_request_id != GlobalRequestID()) { | |
504 params->target_contents->controller().TransferURL( | |
505 url, params->referrer, params->transition, extra_headers, | |
506 params->transferred_global_request_id, | |
507 params->is_renderer_initiated); | |
508 } else if (params->is_renderer_initiated) { | |
503 params->target_contents->controller().LoadURLFromRenderer( | 509 params->target_contents->controller().LoadURLFromRenderer( |
504 url, params->referrer, params->transition, extra_headers); | 510 url, params->referrer, params->transition, extra_headers); |
505 } else { | 511 } else { |
506 params->target_contents->controller().LoadURL( | 512 params->target_contents->controller().LoadURL( |
507 url, params->referrer, params->transition, extra_headers); | 513 url, params->referrer, params->transition, extra_headers); |
508 } | 514 } |
509 } | 515 } |
510 } else { | 516 } else { |
511 // |target_contents| was specified non-NULL, and so we assume it has already | 517 // |target_contents| was specified non-NULL, and so we assume it has already |
512 // been navigated appropriately. We need to do nothing more other than | 518 // been navigated appropriately. We need to do nothing more other than |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 } | 552 } |
547 | 553 |
548 if (singleton_index >= 0) { | 554 if (singleton_index >= 0) { |
549 TabContents* target = params->browser->GetTabContentsAt(singleton_index); | 555 TabContents* target = params->browser->GetTabContentsAt(singleton_index); |
550 | 556 |
551 if (target->is_crashed()) { | 557 if (target->is_crashed()) { |
552 target->controller().Reload(true); | 558 target->controller().Reload(true); |
553 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && | 559 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && |
554 target->GetURL() != params->url) { | 560 target->GetURL() != params->url) { |
555 InitializeExtraHeaders(params, NULL, &extra_headers); | 561 InitializeExtraHeaders(params, NULL, &extra_headers); |
556 if (params->is_renderer_initiated) { | 562 if (params->transferred_global_request_id != GlobalRequestID()) { |
Charlie Reis
2011/12/02 22:38:11
Perhaps we should abstract out this three-clause i
Matt Perry
2011/12/03 00:14:24
Done.
| |
563 target->controller().TransferURL( | |
564 params->url, params->referrer, params->transition, extra_headers, | |
565 params->transferred_global_request_id, | |
566 params->is_renderer_initiated); | |
567 } else if (params->is_renderer_initiated) { | |
557 target->controller().LoadURLFromRenderer( | 568 target->controller().LoadURLFromRenderer( |
558 params->url, params->referrer, params->transition, extra_headers); | 569 params->url, params->referrer, params->transition, extra_headers); |
559 } else { | 570 } else { |
560 target->controller().LoadURL( | 571 target->controller().LoadURL( |
561 params->url, params->referrer, params->transition, extra_headers); | 572 params->url, params->referrer, params->transition, extra_headers); |
562 } | 573 } |
563 } | 574 } |
564 | 575 |
565 // If the singleton tab isn't already selected, select it. | 576 // If the singleton tab isn't already selected, select it. |
566 if (params->source_contents != params->target_contents) | 577 if (params->source_contents != params->target_contents) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
626 // chrome://settings. | 637 // chrome://settings. |
627 | 638 |
628 return !(url.scheme() == chrome::kChromeUIScheme && | 639 return !(url.scheme() == chrome::kChromeUIScheme && |
629 (url.host() == chrome::kChromeUISettingsHost || | 640 (url.host() == chrome::kChromeUISettingsHost || |
630 url.host() == chrome::kChromeUIExtensionsHost || | 641 url.host() == chrome::kChromeUIExtensionsHost || |
631 url.host() == chrome::kChromeUIBookmarksHost || | 642 url.host() == chrome::kChromeUIBookmarksHost || |
632 url.host() == chrome::kChromeUISyncPromoHost)); | 643 url.host() == chrome::kChromeUISyncPromoHost)); |
633 } | 644 } |
634 | 645 |
635 } // namespace browser | 646 } // namespace browser |
OLD | NEW |