OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 new_entry->set_site_instance( | 1053 new_entry->set_site_instance( |
1054 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); | 1054 static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance())); |
1055 new_entry->SetHasPostData(params.is_post); | 1055 new_entry->SetHasPostData(params.is_post); |
1056 new_entry->SetPostID(params.post_id); | 1056 new_entry->SetPostID(params.post_id); |
1057 new_entry->SetOriginalRequestURL(params.original_request_url); | 1057 new_entry->SetOriginalRequestURL(params.original_request_url); |
1058 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); | 1058 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); |
1059 | 1059 |
1060 // history.pushState() is classified as a navigation to a new page, but | 1060 // history.pushState() is classified as a navigation to a new page, but |
1061 // sets was_within_same_page to true. In this case, we already have the | 1061 // sets was_within_same_page to true. In this case, we already have the |
1062 // title available, so set it immediately. | 1062 // title available, so set it immediately. |
1063 if (params.was_within_same_page) | 1063 if (params.was_within_same_page && GetLastCommittedEntry()) |
1064 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle()); | 1064 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle()); |
1065 | 1065 |
1066 DCHECK(!params.history_list_was_cleared || !replace_entry); | 1066 DCHECK(!params.history_list_was_cleared || !replace_entry); |
1067 // The browser requested to clear the session history when it initiated the | 1067 // The browser requested to clear the session history when it initiated the |
1068 // navigation. Now we know that the renderer has updated its state accordingly | 1068 // navigation. Now we know that the renderer has updated its state accordingly |
1069 // and it is safe to also clear the browser side history. | 1069 // and it is safe to also clear the browser side history. |
1070 if (params.history_list_was_cleared) { | 1070 if (params.history_list_was_cleared) { |
1071 DiscardNonCommittedEntriesInternal(); | 1071 DiscardNonCommittedEntriesInternal(); |
1072 entries_.clear(); | 1072 entries_.clear(); |
1073 last_committed_entry_index_ = -1; | 1073 last_committed_entry_index_ = -1; |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 } | 1770 } |
1771 } | 1771 } |
1772 } | 1772 } |
1773 | 1773 |
1774 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1774 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1775 const base::Callback<base::Time()>& get_timestamp_callback) { | 1775 const base::Callback<base::Time()>& get_timestamp_callback) { |
1776 get_timestamp_callback_ = get_timestamp_callback; | 1776 get_timestamp_callback_ = get_timestamp_callback; |
1777 } | 1777 } |
1778 | 1778 |
1779 } // namespace content | 1779 } // namespace content |
OLD | NEW |