OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/navigation_controller.h" | 5 #include "chrome/browser/tab_contents/navigation_controller.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_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 // TODO(brettw) this assumes that the pending entry is appropriate for the | 711 // TODO(brettw) this assumes that the pending entry is appropriate for the |
712 // new page that was just loaded. I don't think this is necessarily the | 712 // new page that was just loaded. I don't think this is necessarily the |
713 // case! We should have some more tracking to know for sure. This goes along | 713 // case! We should have some more tracking to know for sure. This goes along |
714 // with a similar TODO at the top of RendererDidNavigate where we blindly | 714 // with a similar TODO at the top of RendererDidNavigate where we blindly |
715 // set the site instance on the pending entry. | 715 // set the site instance on the pending entry. |
716 new_entry = new NavigationEntry(*pending_entry_); | 716 new_entry = new NavigationEntry(*pending_entry_); |
717 | 717 |
718 // Don't use the page type from the pending entry. Some interstitial page | 718 // Don't use the page type from the pending entry. Some interstitial page |
719 // may have set the type to interstitial. Once we commit, however, the page | 719 // may have set the type to interstitial. Once we commit, however, the page |
720 // type must always be normal. | 720 // type must always be normal. |
721 new_entry->set_page_type(NavigationEntry::NORMAL_PAGE); | 721 new_entry->set_page_type(NORMAL_PAGE); |
722 } else { | 722 } else { |
723 new_entry = new NavigationEntry; | 723 new_entry = new NavigationEntry; |
724 } | 724 } |
725 | 725 |
726 new_entry->set_url(params.url); | 726 new_entry->set_url(params.url); |
727 if (new_entry->update_virtual_url_with_url()) | 727 if (new_entry->update_virtual_url_with_url()) |
728 UpdateVirtualURLToURL(new_entry, params.url); | 728 UpdateVirtualURLToURL(new_entry, params.url); |
729 new_entry->set_referrer(params.referrer); | 729 new_entry->set_referrer(params.referrer); |
730 new_entry->set_page_id(params.page_id); | 730 new_entry->set_page_id(params.page_id); |
731 new_entry->set_transition_type(params.transition); | 731 new_entry->set_transition_type(params.transition); |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 return entries_[transient_entry_index_].get(); | 1193 return entries_[transient_entry_index_].get(); |
1194 } | 1194 } |
1195 | 1195 |
1196 void NavigationController::InsertEntriesFrom( | 1196 void NavigationController::InsertEntriesFrom( |
1197 const NavigationController& source, | 1197 const NavigationController& source, |
1198 int max_index) { | 1198 int max_index) { |
1199 DCHECK_LE(max_index, source.entry_count()); | 1199 DCHECK_LE(max_index, source.entry_count()); |
1200 size_t insert_index = 0; | 1200 size_t insert_index = 0; |
1201 for (int i = 0; i < max_index; i++) { | 1201 for (int i = 0; i < max_index; i++) { |
1202 // When cloning a tab, copy all entries except interstitial pages | 1202 // When cloning a tab, copy all entries except interstitial pages |
1203 if (source.entries_[i].get()->page_type() != | 1203 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
1204 NavigationEntry::INTERSTITIAL_PAGE) { | |
1205 entries_.insert(entries_.begin() + insert_index++, | 1204 entries_.insert(entries_.begin() + insert_index++, |
1206 linked_ptr<NavigationEntry>( | 1205 linked_ptr<NavigationEntry>( |
1207 new NavigationEntry(*source.entries_[i]))); | 1206 new NavigationEntry(*source.entries_[i]))); |
1208 } | 1207 } |
1209 } | 1208 } |
1210 } | 1209 } |
OLD | NEW |