OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 // All manual subframes would get new IDs and were handled above, so we | 634 // All manual subframes would get new IDs and were handled above, so we |
635 // know this is auto. Since the current page was found in the navigation | 635 // know this is auto. Since the current page was found in the navigation |
636 // entry list, we're guaranteed to have a last committed entry. | 636 // entry list, we're guaranteed to have a last committed entry. |
637 DCHECK(GetLastCommittedEntry()); | 637 DCHECK(GetLastCommittedEntry()); |
638 return NavigationType::AUTO_SUBFRAME; | 638 return NavigationType::AUTO_SUBFRAME; |
639 } | 639 } |
640 | 640 |
641 // Anything below here we know is a main frame navigation. | 641 // Anything below here we know is a main frame navigation. |
642 if (pending_entry_ && | 642 if (pending_entry_ && |
643 existing_entry != pending_entry_ && | 643 existing_entry != pending_entry_ && |
644 pending_entry_->page_id() == -1) { | 644 pending_entry_->page_id() == -1 && |
| 645 existing_entry == GetLastCommittedEntry()) { |
645 // In this case, we have a pending entry for a URL but WebCore didn't do a | 646 // In this case, we have a pending entry for a URL but WebCore didn't do a |
646 // new navigation. This happens when you press enter in the URL bar to | 647 // new navigation. This happens when you press enter in the URL bar to |
647 // reload. We will create a pending entry, but WebKit will convert it to | 648 // reload. We will create a pending entry, but WebKit will convert it to |
648 // a reload since it's the same page and not create a new entry for it | 649 // a reload since it's the same page and not create a new entry for it |
649 // (the user doesn't want to have a new back/forward entry when they do | 650 // (the user doesn't want to have a new back/forward entry when they do |
650 // this). In this case, we want to just ignore the pending entry and go | 651 // this). If this matches the last committed entry, we want to just ignore |
651 // back to where we were (the "existing entry"). | 652 // the pending entry and go back to where we were (the "existing entry"). |
652 return NavigationType::SAME_PAGE; | 653 return NavigationType::SAME_PAGE; |
653 } | 654 } |
654 | 655 |
655 // Any toplevel navigations with the same base (minus the reference fragment) | 656 // Any toplevel navigations with the same base (minus the reference fragment) |
656 // are in-page navigations. We weeded out subframe navigations above. Most of | 657 // are in-page navigations. We weeded out subframe navigations above. Most of |
657 // the time this doesn't matter since WebKit doesn't tell us about subframe | 658 // the time this doesn't matter since WebKit doesn't tell us about subframe |
658 // navigations that don't actually navigate, but it can happen when there is | 659 // navigations that don't actually navigate, but it can happen when there is |
659 // an encoding override (it always sends a navigation request). | 660 // an encoding override (it always sends a navigation request). |
660 if (AreURLsInPageNavigation(existing_entry->url(), params.url)) | 661 if (AreURLsInPageNavigation(existing_entry->url(), params.url)) |
661 return NavigationType::IN_PAGE; | 662 return NavigationType::IN_PAGE; |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 size_t insert_index = 0; | 1210 size_t insert_index = 0; |
1210 for (int i = 0; i < max_index; i++) { | 1211 for (int i = 0; i < max_index; i++) { |
1211 // When cloning a tab, copy all entries except interstitial pages | 1212 // When cloning a tab, copy all entries except interstitial pages |
1212 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { | 1213 if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { |
1213 entries_.insert(entries_.begin() + insert_index++, | 1214 entries_.insert(entries_.begin() + insert_index++, |
1214 linked_ptr<NavigationEntry>( | 1215 linked_ptr<NavigationEntry>( |
1215 new NavigationEntry(*source.entries_[i]))); | 1216 new NavigationEntry(*source.entries_[i]))); |
1216 } | 1217 } |
1217 } | 1218 } |
1218 } | 1219 } |
OLD | NEW |