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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #include "content/renderer/gpu/render_widget_compositor.h" | 78 #include "content/renderer/gpu/render_widget_compositor.h" |
79 #include "content/renderer/history_controller.h" | 79 #include "content/renderer/history_controller.h" |
80 #include "content/renderer/history_serialization.h" | 80 #include "content/renderer/history_serialization.h" |
81 #include "content/renderer/idle_user_detector.h" | 81 #include "content/renderer/idle_user_detector.h" |
82 #include "content/renderer/ime_event_guard.h" | 82 #include "content/renderer/ime_event_guard.h" |
83 #include "content/renderer/input/input_handler_manager.h" | 83 #include "content/renderer/input/input_handler_manager.h" |
84 #include "content/renderer/internal_document_state_data.h" | 84 #include "content/renderer/internal_document_state_data.h" |
85 #include "content/renderer/media/audio_device_factory.h" | 85 #include "content/renderer/media/audio_device_factory.h" |
86 #include "content/renderer/media/video_capture_impl_manager.h" | 86 #include "content/renderer/media/video_capture_impl_manager.h" |
87 #include "content/renderer/mhtml_generator.h" | 87 #include "content/renderer/mhtml_generator.h" |
| 88 #include "content/renderer/navigation_state_impl.h" |
88 #include "content/renderer/net_info_helper.h" | 89 #include "content/renderer/net_info_helper.h" |
89 #include "content/renderer/render_frame_impl.h" | 90 #include "content/renderer/render_frame_impl.h" |
90 #include "content/renderer/render_frame_proxy.h" | 91 #include "content/renderer/render_frame_proxy.h" |
91 #include "content/renderer/render_process.h" | 92 #include "content/renderer/render_process.h" |
92 #include "content/renderer/render_thread_impl.h" | 93 #include "content/renderer/render_thread_impl.h" |
93 #include "content/renderer/render_view_mouse_lock_dispatcher.h" | 94 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
94 #include "content/renderer/render_widget_fullscreen_pepper.h" | 95 #include "content/renderer/render_widget_fullscreen_pepper.h" |
95 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 96 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
96 #include "content/renderer/resizing_mode_selector.h" | 97 #include "content/renderer/resizing_mode_selector.h" |
97 #include "content/renderer/savable_resources.h" | 98 #include "content/renderer/savable_resources.h" |
(...skipping 2057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 InternalDocumentStateData::FromDocumentState(old_document_state); | 2156 InternalDocumentStateData::FromDocumentState(old_document_state); |
2156 internal_data->set_is_overriding_user_agent( | 2157 internal_data->set_is_overriding_user_agent( |
2157 old_internal_data->is_overriding_user_agent()); | 2158 old_internal_data->is_overriding_user_agent()); |
2158 } | 2159 } |
2159 } | 2160 } |
2160 | 2161 |
2161 // The rest of RenderView assumes that a WebDataSource will always have a | 2162 // The rest of RenderView assumes that a WebDataSource will always have a |
2162 // non-null NavigationState. | 2163 // non-null NavigationState. |
2163 if (content_initiated) { | 2164 if (content_initiated) { |
2164 document_state->set_navigation_state( | 2165 document_state->set_navigation_state( |
2165 NavigationState::CreateContentInitiated()); | 2166 NavigationStateImpl::CreateContentInitiated()); |
2166 } else { | 2167 } else { |
2167 document_state->set_navigation_state(CreateNavigationStateFromPending()); | 2168 document_state->set_navigation_state(CreateNavigationStateFromPending()); |
2168 pending_navigation_params_.reset(); | 2169 pending_navigation_params_.reset(); |
2169 } | 2170 } |
2170 | 2171 |
2171 // DocumentState::referred_by_prefetcher_ is true if we are | 2172 // DocumentState::referred_by_prefetcher_ is true if we are |
2172 // navigating from a page that used prefetching using a link on that | 2173 // navigating from a page that used prefetching using a link on that |
2173 // page. We are early enough in the request process here that we | 2174 // page. We are early enough in the request process here that we |
2174 // can still see the DocumentState of the previous page and set | 2175 // can still see the DocumentState of the previous page and set |
2175 // this value appropriately. | 2176 // this value appropriately. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 internal_data->set_is_overriding_user_agent( | 2257 internal_data->set_is_overriding_user_agent( |
2257 pending_navigation_params_->commit_params.is_overriding_user_agent); | 2258 pending_navigation_params_->commit_params.is_overriding_user_agent); |
2258 internal_data->set_must_reset_scroll_and_scale_state( | 2259 internal_data->set_must_reset_scroll_and_scale_state( |
2259 pending_navigation_params_->common_params.navigation_type == | 2260 pending_navigation_params_->common_params.navigation_type == |
2260 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); | 2261 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
2261 document_state->set_can_load_local_resources( | 2262 document_state->set_can_load_local_resources( |
2262 pending_navigation_params_->commit_params.can_load_local_resources); | 2263 pending_navigation_params_->commit_params.can_load_local_resources); |
2263 } | 2264 } |
2264 | 2265 |
2265 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { | 2266 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { |
2266 NavigationState* navigation_state = NULL; | |
2267 | |
2268 // A navigation resulting from loading a javascript URL should not be treated | 2267 // A navigation resulting from loading a javascript URL should not be treated |
2269 // as a browser initiated event. Instead, we want it to look as if the page | 2268 // as a browser initiated event. Instead, we want it to look as if the page |
2270 // initiated any load resulting from JS execution. | 2269 // initiated any load resulting from JS execution. |
2271 if (!pending_navigation_params_->common_params.url.SchemeIs( | 2270 if (!pending_navigation_params_->common_params.url.SchemeIs( |
2272 url::kJavaScriptScheme)) { | 2271 url::kJavaScriptScheme)) { |
2273 navigation_state = NavigationState::CreateBrowserInitiated( | 2272 return NavigationStateImpl::CreateBrowserInitiated( |
2274 pending_navigation_params_->history_params.page_id, | 2273 pending_navigation_params_->common_params, |
2275 pending_navigation_params_->history_params.pending_history_list_offset, | 2274 pending_navigation_params_->start_params, |
2276 pending_navigation_params_->history_params.should_clear_history_list, | 2275 pending_navigation_params_->history_params); |
2277 pending_navigation_params_->common_params.transition); | |
2278 navigation_state->set_allow_download( | |
2279 pending_navigation_params_->common_params.allow_download); | |
2280 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
2281 switches::kEnableBrowserSideNavigation)) { | |
2282 navigation_state->set_should_replace_current_entry( | |
2283 pending_navigation_params_->start_params | |
2284 .should_replace_current_entry); | |
2285 navigation_state->set_transferred_request_child_id( | |
2286 pending_navigation_params_->start_params | |
2287 .transferred_request_child_id); | |
2288 navigation_state->set_transferred_request_request_id( | |
2289 pending_navigation_params_->start_params | |
2290 .transferred_request_request_id); | |
2291 navigation_state->set_extra_headers( | |
2292 pending_navigation_params_->start_params.extra_headers); | |
2293 } | |
2294 } else { | |
2295 navigation_state = NavigationState::CreateContentInitiated(); | |
2296 } | 2276 } |
2297 return navigation_state; | 2277 return NavigationStateImpl::CreateContentInitiated(); |
2298 } | 2278 } |
2299 | 2279 |
2300 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, | 2280 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, |
2301 WebIconURL::Type icon_type) { | 2281 WebIconURL::Type icon_type) { |
2302 if (frame->parent()) | 2282 if (frame->parent()) |
2303 return; | 2283 return; |
2304 | 2284 |
2305 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) | 2285 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) |
2306 return; | 2286 return; |
2307 | 2287 |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 std::vector<gfx::Size> sizes; | 4007 std::vector<gfx::Size> sizes; |
4028 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4008 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4029 if (!url.isEmpty()) | 4009 if (!url.isEmpty()) |
4030 urls.push_back( | 4010 urls.push_back( |
4031 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4011 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4032 } | 4012 } |
4033 SendUpdateFaviconURL(urls); | 4013 SendUpdateFaviconURL(urls); |
4034 } | 4014 } |
4035 | 4015 |
4036 } // namespace content | 4016 } // namespace content |
OLD | NEW |