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