| 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 /* | 5 /* |
| 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 SetPageStateIfEmpty((*entries)[i]); | 138 SetPageStateIfEmpty((*entries)[i]); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Determines whether or not we should be carrying over a user agent override | 142 // Determines whether or not we should be carrying over a user agent override |
| 143 // between two NavigationEntries. | 143 // between two NavigationEntries. |
| 144 bool ShouldKeepOverride(const NavigationEntry* last_entry) { | 144 bool ShouldKeepOverride(const NavigationEntry* last_entry) { |
| 145 return last_entry && last_entry->GetIsOverridingUserAgent(); | 145 return last_entry && last_entry->GetIsOverridingUserAgent(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Helper method for FrameTree::ForEach to set the nav_entry_id on each current |
| 149 // RenderFrameHost in the tree. |
| 150 bool SetFrameNavEntryID(int nav_entry_id, FrameTreeNode* node) { |
| 151 node->current_frame_host()->set_nav_entry_id(nav_entry_id); |
| 152 return true; |
| 153 } |
| 154 |
| 148 } // namespace | 155 } // namespace |
| 149 | 156 |
| 150 // NavigationControllerImpl ---------------------------------------------------- | 157 // NavigationControllerImpl ---------------------------------------------------- |
| 151 | 158 |
| 152 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1); | 159 const size_t kMaxEntryCountForTestingNotSet = static_cast<size_t>(-1); |
| 153 | 160 |
| 154 // static | 161 // static |
| 155 size_t NavigationControllerImpl::max_entry_count_for_testing_ = | 162 size_t NavigationControllerImpl::max_entry_count_for_testing_ = |
| 156 kMaxEntryCountForTestingNotSet; | 163 kMaxEntryCountForTestingNotSet; |
| 157 | 164 |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 // deserialization fails. The navigation will continue with default | 947 // deserialization fails. The navigation will continue with default |
| 941 // SSLStatus values. | 948 // SSLStatus values. |
| 942 if (!DeserializeSecurityInfo(params.security_info, &details->ssl_status)) { | 949 if (!DeserializeSecurityInfo(params.security_info, &details->ssl_status)) { |
| 943 bad_message::ReceivedBadMessage( | 950 bad_message::ReceivedBadMessage( |
| 944 rfh->GetProcess(), | 951 rfh->GetProcess(), |
| 945 bad_message::WC_RENDERER_DID_NAVIGATE_BAD_SECURITY_INFO); | 952 bad_message::WC_RENDERER_DID_NAVIGATE_BAD_SECURITY_INFO); |
| 946 } | 953 } |
| 947 | 954 |
| 948 NotifyNavigationEntryCommitted(details); | 955 NotifyNavigationEntryCommitted(details); |
| 949 | 956 |
| 950 // Update the RenderViewHost of the top-level RenderFrameHost's notion of what | 957 // Update the nav_entry_id for each RenderFrameHost in the tree, so that each |
| 951 // entry it's showing for use later. | 958 // one knows the latest NavigationEntry it is showing (whether it has |
| 952 RenderFrameHostImpl* main_frame = | 959 // committed anything in this navigation or not). This allows things like |
| 953 rfh->frame_tree_node()->frame_tree()->root()->current_frame_host(); | 960 // state and title updates from RenderFrames to apply to the latest relevant |
| 954 static_cast<RenderViewHostImpl*>(main_frame->GetRenderViewHost())-> | 961 // NavigationEntry. |
| 955 set_nav_entry_id(active_entry->GetUniqueID()); | 962 delegate_->GetFrameTree()->ForEach( |
| 956 | 963 base::Bind(&SetFrameNavEntryID, active_entry->GetUniqueID())); |
| 957 return true; | 964 return true; |
| 958 } | 965 } |
| 959 | 966 |
| 960 NavigationType NavigationControllerImpl::ClassifyNavigation( | 967 NavigationType NavigationControllerImpl::ClassifyNavigation( |
| 961 RenderFrameHostImpl* rfh, | 968 RenderFrameHostImpl* rfh, |
| 962 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const { | 969 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) const { |
| 963 if (params.did_create_new_entry) { | 970 if (params.did_create_new_entry) { |
| 964 // A new entry. We may or may not have a pending entry for the page, and | 971 // A new entry. We may or may not have a pending entry for the page, and |
| 965 // this may or may not be the main frame. | 972 // this may or may not be the main frame. |
| 966 if (!rfh->GetParent()) { | 973 if (!rfh->GetParent()) { |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 } | 2030 } |
| 2024 } | 2031 } |
| 2025 } | 2032 } |
| 2026 | 2033 |
| 2027 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 2034 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
| 2028 const base::Callback<base::Time()>& get_timestamp_callback) { | 2035 const base::Callback<base::Time()>& get_timestamp_callback) { |
| 2029 get_timestamp_callback_ = get_timestamp_callback; | 2036 get_timestamp_callback_ = get_timestamp_callback; |
| 2030 } | 2037 } |
| 2031 | 2038 |
| 2032 } // namespace content | 2039 } // namespace content |
| OLD | NEW |