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 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 // TODO(davidben): Remove this in favor of passing a cache policy to the | 2200 // TODO(davidben): Remove this in favor of passing a cache policy to the |
2201 // loadHistoryItem call in OnNavigate. That requires not overloading | 2201 // loadHistoryItem call in OnNavigate. That requires not overloading |
2202 // UseProtocolCachePolicy to mean both "normal load" and "determine cache | 2202 // UseProtocolCachePolicy to mean both "normal load" and "determine cache |
2203 // policy based on load type, etc". | 2203 // policy based on load type, etc". |
2204 internal_data->set_cache_policy_override( | 2204 internal_data->set_cache_policy_override( |
2205 WebURLRequest::UseProtocolCachePolicy); | 2205 WebURLRequest::UseProtocolCachePolicy); |
2206 } | 2206 } |
2207 | 2207 |
2208 if (IsReload(pending_navigation_params_->common_params.navigation_type)) | 2208 if (IsReload(pending_navigation_params_->common_params.navigation_type)) |
2209 document_state->set_load_type(DocumentState::RELOAD); | 2209 document_state->set_load_type(DocumentState::RELOAD); |
2210 else if (pending_navigation_params_->history_params.page_state.IsValid()) | 2210 else if (pending_navigation_params_->commit_params.page_state.IsValid()) |
2211 document_state->set_load_type(DocumentState::HISTORY_LOAD); | 2211 document_state->set_load_type(DocumentState::HISTORY_LOAD); |
2212 else | 2212 else |
2213 document_state->set_load_type(DocumentState::NORMAL_LOAD); | 2213 document_state->set_load_type(DocumentState::NORMAL_LOAD); |
2214 | 2214 |
2215 internal_data->set_is_overriding_user_agent( | 2215 internal_data->set_is_overriding_user_agent( |
2216 pending_navigation_params_->commit_params.is_overriding_user_agent); | 2216 pending_navigation_params_->commit_params.is_overriding_user_agent); |
2217 internal_data->set_must_reset_scroll_and_scale_state( | 2217 internal_data->set_must_reset_scroll_and_scale_state( |
2218 pending_navigation_params_->common_params.navigation_type == | 2218 pending_navigation_params_->common_params.navigation_type == |
2219 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); | 2219 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
2220 document_state->set_can_load_local_resources( | 2220 document_state->set_can_load_local_resources( |
2221 pending_navigation_params_->commit_params.can_load_local_resources); | 2221 pending_navigation_params_->commit_params.can_load_local_resources); |
2222 } | 2222 } |
2223 | 2223 |
2224 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 2224 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
2225 // A navigation resulting from loading a javascript URL should not be treated | 2225 // A navigation resulting from loading a javascript URL should not be treated |
2226 // as a browser initiated event. Instead, we want it to look as if the page | 2226 // as a browser initiated event. Instead, we want it to look as if the page |
2227 // initiated any load resulting from JS execution. | 2227 // initiated any load resulting from JS execution. |
2228 if (!pending_navigation_params_->common_params.url.SchemeIs( | 2228 if (!pending_navigation_params_->common_params.url.SchemeIs( |
2229 url::kJavaScriptScheme)) { | 2229 url::kJavaScriptScheme)) { |
2230 return NavigationStateImpl::CreateBrowserInitiated( | 2230 return NavigationStateImpl::CreateBrowserInitiated( |
2231 pending_navigation_params_->common_params, | 2231 pending_navigation_params_->common_params, |
2232 pending_navigation_params_->start_params, | 2232 pending_navigation_params_->start_params, |
2233 pending_navigation_params_->history_params); | 2233 pending_navigation_params_->commit_params); |
2234 } | 2234 } |
2235 return NavigationStateImpl::CreateContentInitiated(); | 2235 return NavigationStateImpl::CreateContentInitiated(); |
2236 } | 2236 } |
2237 | 2237 |
2238 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2238 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
2239 WebIconURL::Type icon_type) { | 2239 WebIconURL::Type icon_type) { |
2240 if (frame->parent()) | 2240 if (frame->parent()) |
2241 return; | 2241 return; |
2242 | 2242 |
2243 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); | 2243 WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type); |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 std::vector<gfx::Size> sizes; | 3961 std::vector<gfx::Size> sizes; |
3962 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3962 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3963 if (!url.isEmpty()) | 3963 if (!url.isEmpty()) |
3964 urls.push_back( | 3964 urls.push_back( |
3965 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3965 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3966 } | 3966 } |
3967 SendUpdateFaviconURL(urls); | 3967 SendUpdateFaviconURL(urls); |
3968 } | 3968 } |
3969 | 3969 |
3970 } // namespace content | 3970 } // namespace content |
OLD | NEW |