| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/navigation_controller.h" | 5 #include "chrome/browser/navigation_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 return AreURLsInPageNavigation(last_committed->url(), url); | 900 return AreURLsInPageNavigation(last_committed->url(), url); |
| 901 } | 901 } |
| 902 | 902 |
| 903 void NavigationController::DiscardPendingEntry() { | 903 void NavigationController::DiscardPendingEntry() { |
| 904 DiscardPendingEntryInternal(); | 904 DiscardPendingEntryInternal(); |
| 905 | 905 |
| 906 // Synchronize the active_contents_ to the last committed entry. | 906 // Synchronize the active_contents_ to the last committed entry. |
| 907 NavigationEntry* last_entry = GetLastCommittedEntry(); | 907 NavigationEntry* last_entry = GetLastCommittedEntry(); |
| 908 if (last_entry && last_entry->tab_type() != active_contents_->type()) { | 908 if (last_entry && last_entry->tab_type() != active_contents_->type()) { |
| 909 TabContents* from_contents = active_contents_; | 909 TabContents* from_contents = active_contents_; |
| 910 from_contents->SetActive(false); | 910 from_contents->set_is_active(false); |
| 911 | 911 |
| 912 // Switch back to the previous tab contents. | 912 // Switch back to the previous tab contents. |
| 913 active_contents_ = GetTabContents(last_entry->tab_type()); | 913 active_contents_ = GetTabContents(last_entry->tab_type()); |
| 914 DCHECK(active_contents_); | 914 DCHECK(active_contents_); |
| 915 | 915 |
| 916 active_contents_->SetActive(true); | 916 active_contents_->set_is_active(true); |
| 917 | 917 |
| 918 // If we are transitioning from two types of WebContents, we need to migrate | 918 // If we are transitioning from two types of WebContents, we need to migrate |
| 919 // the download shelf if it is visible. The download shelf may have been | 919 // the download shelf if it is visible. The download shelf may have been |
| 920 // created before the error that caused us to discard the entry. | 920 // created before the error that caused us to discard the entry. |
| 921 WebContents::MigrateShelfView(from_contents, active_contents_); | 921 WebContents::MigrateShelfView(from_contents, active_contents_); |
| 922 | 922 |
| 923 if (from_contents->delegate()) { | 923 if (from_contents->delegate()) { |
| 924 from_contents->delegate()->ReplaceContents(from_contents, | 924 from_contents->delegate()->ReplaceContents(from_contents, |
| 925 active_contents_); | 925 active_contents_); |
| 926 } | 926 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 if (!pending_entry_) { | 985 if (!pending_entry_) { |
| 986 DCHECK(pending_entry_index_ != -1); | 986 DCHECK(pending_entry_index_ != -1); |
| 987 pending_entry_ = entries_[pending_entry_index_].get(); | 987 pending_entry_ = entries_[pending_entry_index_].get(); |
| 988 } | 988 } |
| 989 | 989 |
| 990 // Reset the security states as any SSL error may have been resolved since we | 990 // Reset the security states as any SSL error may have been resolved since we |
| 991 // last visited that page. | 991 // last visited that page. |
| 992 pending_entry_->ssl() = NavigationEntry::SSLStatus(); | 992 pending_entry_->ssl() = NavigationEntry::SSLStatus(); |
| 993 | 993 |
| 994 if (from_contents && from_contents->type() != pending_entry_->tab_type()) | 994 if (from_contents && from_contents->type() != pending_entry_->tab_type()) |
| 995 from_contents->SetActive(false); | 995 from_contents->set_is_active(false); |
| 996 | 996 |
| 997 HWND parent = | 997 HWND parent = |
| 998 from_contents ? GetParent(from_contents->GetContainerHWND()) : 0; | 998 from_contents ? GetParent(from_contents->GetContainerHWND()) : 0; |
| 999 TabContents* contents = | 999 TabContents* contents = |
| 1000 GetTabContentsCreateIfNecessary(parent, *pending_entry_); | 1000 GetTabContentsCreateIfNecessary(parent, *pending_entry_); |
| 1001 | 1001 |
| 1002 contents->SetActive(true); | 1002 contents->set_is_active(true); |
| 1003 active_contents_ = contents; | 1003 active_contents_ = contents; |
| 1004 | 1004 |
| 1005 if (from_contents && from_contents != contents) { | 1005 if (from_contents && from_contents != contents) { |
| 1006 if (from_contents->delegate()) | 1006 if (from_contents->delegate()) |
| 1007 from_contents->delegate()->ReplaceContents(from_contents, contents); | 1007 from_contents->delegate()->ReplaceContents(from_contents, contents); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 NavigationEntry temp_entry(*pending_entry_); | 1010 NavigationEntry temp_entry(*pending_entry_); |
| 1011 if (!contents->NavigateToPendingEntry(reload)) | 1011 if (!contents->NavigateToPendingEntry(reload)) |
| 1012 DiscardPendingEntry(); | 1012 DiscardPendingEntry(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 int NavigationController::GetEntryIndexWithPageID( | 1218 int NavigationController::GetEntryIndexWithPageID( |
| 1219 TabContentsType type, SiteInstance* instance, int32 page_id) const { | 1219 TabContentsType type, SiteInstance* instance, int32 page_id) const { |
| 1220 for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) { | 1220 for (int i = static_cast<int>(entries_.size()) - 1; i >= 0; --i) { |
| 1221 if ((entries_[i]->tab_type() == type) && | 1221 if ((entries_[i]->tab_type() == type) && |
| 1222 (entries_[i]->site_instance() == instance) && | 1222 (entries_[i]->site_instance() == instance) && |
| 1223 (entries_[i]->page_id() == page_id)) | 1223 (entries_[i]->page_id() == page_id)) |
| 1224 return i; | 1224 return i; |
| 1225 } | 1225 } |
| 1226 return -1; | 1226 return -1; |
| 1227 } | 1227 } |
| OLD | NEW |