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/tab_contents/navigation_controller_impl.h" | 5 #include "content/browser/tab_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 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 | 846 |
847 new_entry->SetURL(params.url); | 847 new_entry->SetURL(params.url); |
848 if (update_virtual_url) | 848 if (update_virtual_url) |
849 UpdateVirtualURLToURL(new_entry, params.url); | 849 UpdateVirtualURLToURL(new_entry, params.url); |
850 new_entry->SetReferrer(params.referrer); | 850 new_entry->SetReferrer(params.referrer); |
851 new_entry->SetPageID(params.page_id); | 851 new_entry->SetPageID(params.page_id); |
852 new_entry->SetTransitionType(params.transition); | 852 new_entry->SetTransitionType(params.transition); |
853 new_entry->set_site_instance( | 853 new_entry->set_site_instance( |
854 static_cast<SiteInstanceImpl*>(tab_contents_->GetSiteInstance())); | 854 static_cast<SiteInstanceImpl*>(tab_contents_->GetSiteInstance())); |
855 new_entry->SetHasPostData(params.is_post); | 855 new_entry->SetHasPostData(params.is_post); |
| 856 new_entry->SetPostID(params.post_id); |
856 | 857 |
857 InsertOrReplaceEntry(new_entry, *did_replace_entry); | 858 InsertOrReplaceEntry(new_entry, *did_replace_entry); |
858 } | 859 } |
859 | 860 |
860 void NavigationControllerImpl::RendererDidNavigateToExistingPage( | 861 void NavigationControllerImpl::RendererDidNavigateToExistingPage( |
861 const ViewHostMsg_FrameNavigate_Params& params) { | 862 const ViewHostMsg_FrameNavigate_Params& params) { |
862 // We should only get here for main frame navigations. | 863 // We should only get here for main frame navigations. |
863 DCHECK(content::PageTransitionIsMainFrame(params.transition)); | 864 DCHECK(content::PageTransitionIsMainFrame(params.transition)); |
864 | 865 |
865 // This is a back/forward navigation. The existing page for the ID is | 866 // This is a back/forward navigation. The existing page for the ID is |
(...skipping 10 matching lines...) Expand all Loading... |
876 // assigned. | 877 // assigned. |
877 entry->SetURL(params.url); | 878 entry->SetURL(params.url); |
878 if (entry->update_virtual_url_with_url()) | 879 if (entry->update_virtual_url_with_url()) |
879 UpdateVirtualURLToURL(entry, params.url); | 880 UpdateVirtualURLToURL(entry, params.url); |
880 DCHECK(entry->site_instance() == NULL || | 881 DCHECK(entry->site_instance() == NULL || |
881 entry->site_instance() == tab_contents_->GetSiteInstance()); | 882 entry->site_instance() == tab_contents_->GetSiteInstance()); |
882 entry->set_site_instance( | 883 entry->set_site_instance( |
883 static_cast<SiteInstanceImpl*>(tab_contents_->GetSiteInstance())); | 884 static_cast<SiteInstanceImpl*>(tab_contents_->GetSiteInstance())); |
884 | 885 |
885 entry->SetHasPostData(params.is_post); | 886 entry->SetHasPostData(params.is_post); |
| 887 entry->SetPostID(params.post_id); |
886 | 888 |
887 // The entry we found in the list might be pending if the user hit | 889 // The entry we found in the list might be pending if the user hit |
888 // back/forward/reload. This load should commit it (since it's already in the | 890 // back/forward/reload. This load should commit it (since it's already in the |
889 // list, we can just discard the pending pointer). We should also discard the | 891 // list, we can just discard the pending pointer). We should also discard the |
890 // pending entry if it corresponds to a different navigation, since that one | 892 // pending entry if it corresponds to a different navigation, since that one |
891 // is now likely canceled. If it is not canceled, we will treat it as a new | 893 // is now likely canceled. If it is not canceled, we will treat it as a new |
892 // navigation when it arrives, which is also ok. | 894 // navigation when it arrives, which is also ok. |
893 // | 895 // |
894 // Note that we need to use the "internal" version since we don't want to | 896 // Note that we need to use the "internal" version since we don't want to |
895 // actually change any other state, just kill the pointer. | 897 // actually change any other state, just kill the pointer. |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 for (int i = 0; i < max_index; i++) { | 1403 for (int i = 0; i < max_index; i++) { |
1402 // When cloning a tab, copy all entries except interstitial pages | 1404 // When cloning a tab, copy all entries except interstitial pages |
1403 if (source.entries_[i].get()->GetPageType() != | 1405 if (source.entries_[i].get()->GetPageType() != |
1404 content::PAGE_TYPE_INTERSTITIAL) { | 1406 content::PAGE_TYPE_INTERSTITIAL) { |
1405 entries_.insert(entries_.begin() + insert_index++, | 1407 entries_.insert(entries_.begin() + insert_index++, |
1406 linked_ptr<NavigationEntryImpl>( | 1408 linked_ptr<NavigationEntryImpl>( |
1407 new NavigationEntryImpl(*source.entries_[i]))); | 1409 new NavigationEntryImpl(*source.entries_[i]))); |
1408 } | 1410 } |
1409 } | 1411 } |
1410 } | 1412 } |
OLD | NEW |