| 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 "content/browser/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 // case! We should have some more tracking to know for sure. | 916 // case! We should have some more tracking to know for sure. |
| 917 new_entry = new NavigationEntryImpl(*pending_entry_); | 917 new_entry = new NavigationEntryImpl(*pending_entry_); |
| 918 | 918 |
| 919 // Don't use the page type from the pending entry. Some interstitial page | 919 // Don't use the page type from the pending entry. Some interstitial page |
| 920 // may have set the type to interstitial. Once we commit, however, the page | 920 // may have set the type to interstitial. Once we commit, however, the page |
| 921 // type must always be normal. | 921 // type must always be normal. |
| 922 new_entry->set_page_type(content::PAGE_TYPE_NORMAL); | 922 new_entry->set_page_type(content::PAGE_TYPE_NORMAL); |
| 923 update_virtual_url = new_entry->update_virtual_url_with_url(); | 923 update_virtual_url = new_entry->update_virtual_url_with_url(); |
| 924 } else { | 924 } else { |
| 925 new_entry = new NavigationEntryImpl; | 925 new_entry = new NavigationEntryImpl; |
| 926 |
| 927 // Find out whether the new entry needs to update its virtual URL on URL |
| 928 // change and set up the entry accordingly. This is needed to correctly |
| 929 // update the virtual URL when replaceState is called after a pushState. |
| 930 GURL url = params.url; |
| 931 bool needs_update = false; |
| 932 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
| 933 &url, browser_context_, &needs_update); |
| 934 new_entry->set_update_virtual_url_with_url(needs_update); |
| 935 |
| 926 // When navigating to a new page, give the browser URL handler a chance to | 936 // When navigating to a new page, give the browser URL handler a chance to |
| 927 // update the virtual URL based on the new URL. For example, this is needed | 937 // update the virtual URL based on the new URL. For example, this is needed |
| 928 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes | 938 // to show chrome://bookmarks/#1 when the bookmarks webui extension changes |
| 929 // the URL. | 939 // the URL. |
| 930 update_virtual_url = true; | 940 update_virtual_url = needs_update; |
| 931 } | 941 } |
| 932 | 942 |
| 933 new_entry->SetURL(params.url); | 943 new_entry->SetURL(params.url); |
| 934 if (update_virtual_url) | 944 if (update_virtual_url) |
| 935 UpdateVirtualURLToURL(new_entry, params.url); | 945 UpdateVirtualURLToURL(new_entry, params.url); |
| 936 new_entry->SetReferrer(params.referrer); | 946 new_entry->SetReferrer(params.referrer); |
| 937 new_entry->SetPageID(params.page_id); | 947 new_entry->SetPageID(params.page_id); |
| 938 new_entry->SetTransitionType(params.transition); | 948 new_entry->SetTransitionType(params.transition); |
| 939 new_entry->set_site_instance( | 949 new_entry->set_site_instance( |
| 940 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); | 950 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 for (int i = 0; i < max_index; i++) { | 1574 for (int i = 0; i < max_index; i++) { |
| 1565 // When cloning a tab, copy all entries except interstitial pages | 1575 // When cloning a tab, copy all entries except interstitial pages |
| 1566 if (source.entries_[i].get()->GetPageType() != | 1576 if (source.entries_[i].get()->GetPageType() != |
| 1567 content::PAGE_TYPE_INTERSTITIAL) { | 1577 content::PAGE_TYPE_INTERSTITIAL) { |
| 1568 entries_.insert(entries_.begin() + insert_index++, | 1578 entries_.insert(entries_.begin() + insert_index++, |
| 1569 linked_ptr<NavigationEntryImpl>( | 1579 linked_ptr<NavigationEntryImpl>( |
| 1570 new NavigationEntryImpl(*source.entries_[i]))); | 1580 new NavigationEntryImpl(*source.entries_[i]))); |
| 1571 } | 1581 } |
| 1572 } | 1582 } |
| 1573 } | 1583 } |
| OLD | NEW |