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