Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1001043002: Refactor NavigationState to use NavigationParams (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 InternalDocumentStateData::FromDocumentState(old_document_state); 2123 InternalDocumentStateData::FromDocumentState(old_document_state);
2123 internal_data->set_is_overriding_user_agent( 2124 internal_data->set_is_overriding_user_agent(
2124 old_internal_data->is_overriding_user_agent()); 2125 old_internal_data->is_overriding_user_agent());
2125 } 2126 }
2126 } 2127 }
2127 2128
2128 // The rest of RenderView assumes that a WebDataSource will always have a 2129 // The rest of RenderView assumes that a WebDataSource will always have a
2129 // non-null NavigationState. 2130 // non-null NavigationState.
2130 if (content_initiated) { 2131 if (content_initiated) {
2131 document_state->set_navigation_state( 2132 document_state->set_navigation_state(
2132 NavigationState::CreateContentInitiated()); 2133 NavigationStateImpl::CreateContentInitiated());
2133 } else { 2134 } else {
2134 document_state->set_navigation_state(CreateNavigationStateFromPending()); 2135 document_state->set_navigation_state(CreateNavigationStateFromPending());
2135 pending_navigation_params_.reset(); 2136 pending_navigation_params_.reset();
2136 } 2137 }
2137 2138
2138 // DocumentState::referred_by_prefetcher_ is true if we are 2139 // DocumentState::referred_by_prefetcher_ is true if we are
2139 // navigating from a page that used prefetching using a link on that 2140 // navigating from a page that used prefetching using a link on that
2140 // page. We are early enough in the request process here that we 2141 // page. We are early enough in the request process here that we
2141 // can still see the DocumentState of the previous page and set 2142 // can still see the DocumentState of the previous page and set
2142 // this value appropriately. 2143 // this value appropriately.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 internal_data->set_is_overriding_user_agent( 2224 internal_data->set_is_overriding_user_agent(
2224 pending_navigation_params_->commit_params.is_overriding_user_agent); 2225 pending_navigation_params_->commit_params.is_overriding_user_agent);
2225 internal_data->set_must_reset_scroll_and_scale_state( 2226 internal_data->set_must_reset_scroll_and_scale_state(
2226 pending_navigation_params_->common_params.navigation_type == 2227 pending_navigation_params_->common_params.navigation_type ==
2227 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); 2228 FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL);
2228 document_state->set_can_load_local_resources( 2229 document_state->set_can_load_local_resources(
2229 pending_navigation_params_->commit_params.can_load_local_resources); 2230 pending_navigation_params_->commit_params.can_load_local_resources);
2230 } 2231 }
2231 2232
2232 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() { 2233 NavigationState* RenderViewImpl::CreateNavigationStateFromPending() {
2233 NavigationState* navigation_state = NULL;
2234
2235 // A navigation resulting from loading a javascript URL should not be treated 2234 // A navigation resulting from loading a javascript URL should not be treated
2236 // as a browser initiated event. Instead, we want it to look as if the page 2235 // as a browser initiated event. Instead, we want it to look as if the page
2237 // initiated any load resulting from JS execution. 2236 // initiated any load resulting from JS execution.
2238 if (!pending_navigation_params_->common_params.url.SchemeIs( 2237 if (!pending_navigation_params_->common_params.url.SchemeIs(
2239 url::kJavaScriptScheme)) { 2238 url::kJavaScriptScheme)) {
2240 navigation_state = NavigationState::CreateBrowserInitiated( 2239 return NavigationStateImpl::CreateBrowserInitiated(
2241 pending_navigation_params_->history_params.page_id, 2240 pending_navigation_params_->common_params,
2242 pending_navigation_params_->history_params.pending_history_list_offset, 2241 pending_navigation_params_->start_params,
2243 pending_navigation_params_->history_params.should_clear_history_list, 2242 pending_navigation_params_->history_params);
2244 pending_navigation_params_->common_params.transition);
2245 navigation_state->set_allow_download(
2246 pending_navigation_params_->common_params.allow_download);
2247 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
2248 switches::kEnableBrowserSideNavigation)) {
2249 navigation_state->set_should_replace_current_entry(
2250 pending_navigation_params_->start_params
2251 .should_replace_current_entry);
2252 navigation_state->set_transferred_request_child_id(
2253 pending_navigation_params_->start_params
2254 .transferred_request_child_id);
2255 navigation_state->set_transferred_request_request_id(
2256 pending_navigation_params_->start_params
2257 .transferred_request_request_id);
2258 navigation_state->set_extra_headers(
2259 pending_navigation_params_->start_params.extra_headers);
2260 }
2261 } else {
2262 navigation_state = NavigationState::CreateContentInitiated();
2263 } 2243 }
2264 return navigation_state; 2244 return NavigationStateImpl::CreateContentInitiated();
2265 } 2245 }
2266 2246
2267 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame, 2247 void RenderViewImpl::didChangeIcon(WebLocalFrame* frame,
2268 WebIconURL::Type icon_type) { 2248 WebIconURL::Type icon_type) {
2269 if (frame->parent()) 2249 if (frame->parent())
2270 return; 2250 return;
2271 2251
2272 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon) 2252 if (!TouchEnabled() && icon_type != WebIconURL::TypeFavicon)
2273 return; 2253 return;
2274 2254
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 std::vector<gfx::Size> sizes; 3974 std::vector<gfx::Size> sizes;
3995 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3975 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3996 if (!url.isEmpty()) 3976 if (!url.isEmpty())
3997 urls.push_back( 3977 urls.push_back(
3998 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3978 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3999 } 3979 }
4000 SendUpdateFaviconURL(urls); 3980 SendUpdateFaviconURL(urls);
4001 } 3981 }
4002 3982
4003 } // namespace content 3983 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698