| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 } | 2123 } |
| 2124 | 2124 |
| 2125 void RenderViewImpl::PopulateDocumentStateFromPending( | 2125 void RenderViewImpl::PopulateDocumentStateFromPending( |
| 2126 DocumentState* document_state) { | 2126 DocumentState* document_state) { |
| 2127 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 2127 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
| 2128 document_state->set_request_time(params.request_time); | 2128 document_state->set_request_time(params.request_time); |
| 2129 | 2129 |
| 2130 InternalDocumentStateData* internal_data = | 2130 InternalDocumentStateData* internal_data = |
| 2131 InternalDocumentStateData::FromDocumentState(document_state); | 2131 InternalDocumentStateData::FromDocumentState(document_state); |
| 2132 | 2132 |
| 2133 if (!params.url.SchemeIs(kJavaScriptScheme) && | 2133 if (!params.url.SchemeIs(url::kJavaScriptScheme) && |
| 2134 params.navigation_type == FrameMsg_Navigate_Type::RESTORE) { | 2134 params.navigation_type == FrameMsg_Navigate_Type::RESTORE) { |
| 2135 // We're doing a load of a page that was restored from the last session. By | 2135 // We're doing a load of a page that was restored from the last session. By |
| 2136 // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which | 2136 // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which |
| 2137 // can result in stale data for pages that are set to expire. We explicitly | 2137 // can result in stale data for pages that are set to expire. We explicitly |
| 2138 // override that by setting the policy here so that as necessary we load | 2138 // override that by setting the policy here so that as necessary we load |
| 2139 // from the network. | 2139 // from the network. |
| 2140 // | 2140 // |
| 2141 // TODO(davidben): Remove this in favor of passing a cache policy to the | 2141 // TODO(davidben): Remove this in favor of passing a cache policy to the |
| 2142 // loadHistoryItem call in OnNavigate. That requires not overloading | 2142 // loadHistoryItem call in OnNavigate. That requires not overloading |
| 2143 // UseProtocolCachePolicy to mean both "normal load" and "determine cache | 2143 // UseProtocolCachePolicy to mean both "normal load" and "determine cache |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2160 document_state->set_can_load_local_resources(params.can_load_local_resources); | 2160 document_state->set_can_load_local_resources(params.can_load_local_resources); |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 2163 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
| 2164 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 2164 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
| 2165 NavigationState* navigation_state = NULL; | 2165 NavigationState* navigation_state = NULL; |
| 2166 | 2166 |
| 2167 // A navigation resulting from loading a javascript URL should not be treated | 2167 // A navigation resulting from loading a javascript URL should not be treated |
| 2168 // as a browser initiated event. Instead, we want it to look as if the page | 2168 // as a browser initiated event. Instead, we want it to look as if the page |
| 2169 // initiated any load resulting from JS execution. | 2169 // initiated any load resulting from JS execution. |
| 2170 if (!params.url.SchemeIs(kJavaScriptScheme)) { | 2170 if (!params.url.SchemeIs(url::kJavaScriptScheme)) { |
| 2171 navigation_state = NavigationState::CreateBrowserInitiated( | 2171 navigation_state = NavigationState::CreateBrowserInitiated( |
| 2172 params.page_id, | 2172 params.page_id, |
| 2173 params.pending_history_list_offset, | 2173 params.pending_history_list_offset, |
| 2174 params.should_clear_history_list, | 2174 params.should_clear_history_list, |
| 2175 params.transition); | 2175 params.transition); |
| 2176 navigation_state->set_should_replace_current_entry( | 2176 navigation_state->set_should_replace_current_entry( |
| 2177 params.should_replace_current_entry); | 2177 params.should_replace_current_entry); |
| 2178 navigation_state->set_transferred_request_child_id( | 2178 navigation_state->set_transferred_request_child_id( |
| 2179 params.transferred_request_child_id); | 2179 params.transferred_request_child_id); |
| 2180 navigation_state->set_transferred_request_request_id( | 2180 navigation_state->set_transferred_request_request_id( |
| (...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4106 std::vector<gfx::Size> sizes; | 4106 std::vector<gfx::Size> sizes; |
| 4107 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4107 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4108 if (!url.isEmpty()) | 4108 if (!url.isEmpty()) |
| 4109 urls.push_back( | 4109 urls.push_back( |
| 4110 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4110 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4111 } | 4111 } |
| 4112 SendUpdateFaviconURL(urls); | 4112 SendUpdateFaviconURL(urls); |
| 4113 } | 4113 } |
| 4114 | 4114 |
| 4115 } // namespace content | 4115 } // namespace content |
| OLD | NEW |