| 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/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.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_number_conversions.h" // Temporary | 10 #include "base/string_number_conversions.h" // Temporary |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 | 1004 |
| 1005 // This is a back/forward navigation. The existing page for the ID is | 1005 // This is a back/forward navigation. The existing page for the ID is |
| 1006 // guaranteed to exist by ClassifyNavigation, and we just need to update it | 1006 // guaranteed to exist by ClassifyNavigation, and we just need to update it |
| 1007 // with new information from the renderer. | 1007 // with new information from the renderer. |
| 1008 int entry_index = GetEntryIndexWithPageID(web_contents_->GetSiteInstance(), | 1008 int entry_index = GetEntryIndexWithPageID(web_contents_->GetSiteInstance(), |
| 1009 params.page_id); | 1009 params.page_id); |
| 1010 DCHECK(entry_index >= 0 && | 1010 DCHECK(entry_index >= 0 && |
| 1011 entry_index < static_cast<int>(entries_.size())); | 1011 entry_index < static_cast<int>(entries_.size())); |
| 1012 NavigationEntryImpl* entry = entries_[entry_index].get(); | 1012 NavigationEntryImpl* entry = entries_[entry_index].get(); |
| 1013 | 1013 |
| 1014 // The URL may have changed due to redirects. The site instance will normally | 1014 // The URL may have changed due to redirects. |
| 1015 // be the same except during session restore, when no site instance will be | |
| 1016 // assigned. | |
| 1017 entry->SetURL(params.url); | 1015 entry->SetURL(params.url); |
| 1018 if (entry->update_virtual_url_with_url()) | 1016 if (entry->update_virtual_url_with_url()) |
| 1019 UpdateVirtualURLToURL(entry, params.url); | 1017 UpdateVirtualURLToURL(entry, params.url); |
| 1018 |
| 1019 // The redirected to page should not inherit the favicon from the previous |
| 1020 // page. |
| 1021 if (PageTransitionIsRedirect(params.transition)) |
| 1022 entry->GetFavicon() = content::FaviconStatus(); |
| 1023 |
| 1024 // The site instance will normally be the same except during session restore, |
| 1025 // when no site instance will be assigned. |
| 1020 DCHECK(entry->site_instance() == NULL || | 1026 DCHECK(entry->site_instance() == NULL || |
| 1021 entry->site_instance() == web_contents_->GetSiteInstance()); | 1027 entry->site_instance() == web_contents_->GetSiteInstance()); |
| 1022 entry->set_site_instance( | 1028 entry->set_site_instance( |
| 1023 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); | 1029 static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); |
| 1024 | 1030 |
| 1025 entry->SetHasPostData(params.is_post); | 1031 entry->SetHasPostData(params.is_post); |
| 1026 entry->SetPostID(params.post_id); | 1032 entry->SetPostID(params.post_id); |
| 1027 | 1033 |
| 1028 // The entry we found in the list might be pending if the user hit | 1034 // The entry we found in the list might be pending if the user hit |
| 1029 // back/forward/reload. This load should commit it (since it's already in the | 1035 // back/forward/reload. This load should commit it (since it's already in the |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 linked_ptr<NavigationEntryImpl>( | 1626 linked_ptr<NavigationEntryImpl>( |
| 1621 new NavigationEntryImpl(*source.entries_[i]))); | 1627 new NavigationEntryImpl(*source.entries_[i]))); |
| 1622 } | 1628 } |
| 1623 } | 1629 } |
| 1624 } | 1630 } |
| 1625 | 1631 |
| 1626 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1632 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 1627 const base::Callback<base::Time()>& get_timestamp_callback) { | 1633 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 1628 get_timestamp_callback_ = get_timestamp_callback; | 1634 get_timestamp_callback_ = get_timestamp_callback; |
| 1629 } | 1635 } |
| OLD | NEW |