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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 params->target_contents = CreateTargetContents(*params, params->url); | 614 params->target_contents = CreateTargetContents(*params, params->url); |
615 | 615 |
616 // This function takes ownership of |params->target_contents| until it | 616 // This function takes ownership of |params->target_contents| until it |
617 // is added to a TabStripModel. | 617 // is added to a TabStripModel. |
618 target_contents_owner.TakeOwnership(); | 618 target_contents_owner.TakeOwnership(); |
619 } else { | 619 } else { |
620 // ... otherwise if we're loading in the current tab, the target is the | 620 // ... otherwise if we're loading in the current tab, the target is the |
621 // same as the source. | 621 // same as the source. |
622 DCHECK(params->source_contents); | 622 DCHECK(params->source_contents); |
623 params->target_contents = params->source_contents; | 623 params->target_contents = params->source_contents; |
| 624 |
| 625 // Prerender can only swap in CURRENT_TAB navigations; others have |
| 626 // different sessionStorage namespaces. |
| 627 swapped_in_prerender = SwapInPrerender(params->url, params); |
624 } | 628 } |
625 | 629 |
626 // Note: at this point, if |params->disposition| is not CURRENT_TAB, | |
627 // |params->target_contents| has not been attached to a Browser yet. (That | |
628 // happens later in this function.) However, in that case, the | |
629 // sessionStorage namespace could not match, so prerender will use the | |
630 // asynchronous codepath and still swap. | |
631 DCHECK(params->target_contents); | |
632 swapped_in_prerender = SwapInPrerender(params->url, params); | |
633 | |
634 if (user_initiated) | 630 if (user_initiated) |
635 params->target_contents->UserGestureDone(); | 631 params->target_contents->UserGestureDone(); |
636 | 632 |
637 if (!swapped_in_prerender) { | 633 if (!swapped_in_prerender) { |
638 // Try to handle non-navigational URLs that popup dialogs and such, these | 634 // Try to handle non-navigational URLs that popup dialogs and such, these |
639 // should not actually navigate. | 635 // should not actually navigate. |
640 if (!HandleNonNavigationAboutURL(params->url)) { | 636 if (!HandleNonNavigationAboutURL(params->url)) { |
641 // Perform the actual navigation, tracking whether it came from the | 637 // Perform the actual navigation, tracking whether it came from the |
642 // renderer. | 638 // renderer. |
643 | 639 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 bool reverse_on_redirect = false; | 765 bool reverse_on_redirect = false; |
770 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 766 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
771 &rewritten_url, browser_context, &reverse_on_redirect); | 767 &rewritten_url, browser_context, &reverse_on_redirect); |
772 | 768 |
773 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 769 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
774 return !(rewritten_url.scheme() == content::kChromeUIScheme && | 770 return !(rewritten_url.scheme() == content::kChromeUIScheme && |
775 rewritten_url.host() == chrome::kChromeUIUberHost); | 771 rewritten_url.host() == chrome::kChromeUIUberHost); |
776 } | 772 } |
777 | 773 |
778 } // namespace chrome | 774 } // namespace chrome |
OLD | NEW |