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 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 } | 2064 } |
2065 | 2065 |
2066 void RenderViewImpl::PopulateDocumentStateFromPending( | 2066 void RenderViewImpl::PopulateDocumentStateFromPending( |
2067 DocumentState* document_state) { | 2067 DocumentState* document_state) { |
2068 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 2068 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
2069 document_state->set_request_time(params.request_time); | 2069 document_state->set_request_time(params.request_time); |
2070 | 2070 |
2071 InternalDocumentStateData* internal_data = | 2071 InternalDocumentStateData* internal_data = |
2072 InternalDocumentStateData::FromDocumentState(document_state); | 2072 InternalDocumentStateData::FromDocumentState(document_state); |
2073 | 2073 |
2074 if (!params.url.SchemeIs(kJavaScriptScheme) && | 2074 if (!params.url.SchemeIs(url::kJavaScriptScheme) && |
2075 params.navigation_type == FrameMsg_Navigate_Type::RESTORE) { | 2075 params.navigation_type == FrameMsg_Navigate_Type::RESTORE) { |
2076 // We're doing a load of a page that was restored from the last session. By | 2076 // We're doing a load of a page that was restored from the last session. By |
2077 // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which | 2077 // default this prefers the cache over loading (LOAD_PREFERRING_CACHE) which |
2078 // can result in stale data for pages that are set to expire. We explicitly | 2078 // can result in stale data for pages that are set to expire. We explicitly |
2079 // override that by setting the policy here so that as necessary we load | 2079 // override that by setting the policy here so that as necessary we load |
2080 // from the network. | 2080 // from the network. |
2081 // | 2081 // |
2082 // TODO(davidben): Remove this in favor of passing a cache policy to the | 2082 // TODO(davidben): Remove this in favor of passing a cache policy to the |
2083 // loadHistoryItem call in OnNavigate. That requires not overloading | 2083 // loadHistoryItem call in OnNavigate. That requires not overloading |
2084 // UseProtocolCachePolicy to mean both "normal load" and "determine cache | 2084 // UseProtocolCachePolicy to mean both "normal load" and "determine cache |
(...skipping 16 matching lines...) Expand all Loading... |
2101 document_state->set_can_load_local_resources(params.can_load_local_resources); | 2101 document_state->set_can_load_local_resources(params.can_load_local_resources); |
2102 } | 2102 } |
2103 | 2103 |
2104 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 2104 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
2105 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); | 2105 const FrameMsg_Navigate_Params& params = *pending_navigation_params_.get(); |
2106 NavigationState* navigation_state = NULL; | 2106 NavigationState* navigation_state = NULL; |
2107 | 2107 |
2108 // A navigation resulting from loading a javascript URL should not be treated | 2108 // A navigation resulting from loading a javascript URL should not be treated |
2109 // as a browser initiated event. Instead, we want it to look as if the page | 2109 // as a browser initiated event. Instead, we want it to look as if the page |
2110 // initiated any load resulting from JS execution. | 2110 // initiated any load resulting from JS execution. |
2111 if (!params.url.SchemeIs(kJavaScriptScheme)) { | 2111 if (!params.url.SchemeIs(url::kJavaScriptScheme)) { |
2112 navigation_state = NavigationState::CreateBrowserInitiated( | 2112 navigation_state = NavigationState::CreateBrowserInitiated( |
2113 params.page_id, | 2113 params.page_id, |
2114 params.pending_history_list_offset, | 2114 params.pending_history_list_offset, |
2115 params.should_clear_history_list, | 2115 params.should_clear_history_list, |
2116 params.transition); | 2116 params.transition); |
2117 navigation_state->set_should_replace_current_entry( | 2117 navigation_state->set_should_replace_current_entry( |
2118 params.should_replace_current_entry); | 2118 params.should_replace_current_entry); |
2119 navigation_state->set_transferred_request_child_id( | 2119 navigation_state->set_transferred_request_child_id( |
2120 params.transferred_request_child_id); | 2120 params.transferred_request_child_id); |
2121 navigation_state->set_transferred_request_request_id( | 2121 navigation_state->set_transferred_request_request_id( |
(...skipping 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 std::vector<gfx::Size> sizes; | 4067 std::vector<gfx::Size> sizes; |
4068 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4068 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4069 if (!url.isEmpty()) | 4069 if (!url.isEmpty()) |
4070 urls.push_back( | 4070 urls.push_back( |
4071 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4071 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4072 } | 4072 } |
4073 SendUpdateFaviconURL(urls); | 4073 SendUpdateFaviconURL(urls); |
4074 } | 4074 } |
4075 | 4075 |
4076 } // namespace content | 4076 } // namespace content |
OLD | NEW |