OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 bool has_browser_initiated_pending_entry = pending_entry && | 257 bool has_browser_initiated_pending_entry = pending_entry && |
258 !pending_entry->is_renderer_initiated(); | 258 !pending_entry->is_renderer_initiated(); |
259 if (!has_browser_initiated_pending_entry && !is_error_page) { | 259 if (!has_browser_initiated_pending_entry && !is_error_page) { |
260 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | 260 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
261 controller_->CreateNavigationEntry(validated_url, | 261 controller_->CreateNavigationEntry(validated_url, |
262 content::Referrer(), | 262 content::Referrer(), |
263 ui::PAGE_TRANSITION_LINK, | 263 ui::PAGE_TRANSITION_LINK, |
264 true /* is_renderer_initiated */, | 264 true /* is_renderer_initiated */, |
265 std::string(), | 265 std::string(), |
266 controller_->GetBrowserContext())); | 266 controller_->GetBrowserContext())); |
267 entry->set_site_instance( | 267 entry->set_site_instance(render_frame_host->GetSiteInstance()); |
268 static_cast<SiteInstanceImpl*>( | |
269 render_frame_host->render_view_host()->GetSiteInstance())); | |
270 // TODO(creis): If there's a pending entry already, find a safe way to | 268 // TODO(creis): If there's a pending entry already, find a safe way to |
271 // update it instead of replacing it and copying over things like this. | 269 // update it instead of replacing it and copying over things like this. |
272 if (pending_entry) { | 270 if (pending_entry) { |
273 entry->set_transferred_global_request_id( | 271 entry->set_transferred_global_request_id( |
274 pending_entry->transferred_global_request_id()); | 272 pending_entry->transferred_global_request_id()); |
275 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 273 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
276 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 274 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
277 } | 275 } |
278 controller_->SetPendingEntry(entry); | 276 controller_->SetPendingEntry(entry); |
279 if (delegate_) | 277 if (delegate_) |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (use_site_per_process) { | 558 if (use_site_per_process) { |
561 FrameTreeNode* frame = render_frame_host->frame_tree_node(); | 559 FrameTreeNode* frame = render_frame_host->frame_tree_node(); |
562 frame->render_manager()->DidNavigateFrame( | 560 frame->render_manager()->DidNavigateFrame( |
563 render_frame_host, params.gesture == NavigationGestureUser); | 561 render_frame_host, params.gesture == NavigationGestureUser); |
564 } | 562 } |
565 | 563 |
566 // Update the site of the SiteInstance if it doesn't have one yet, unless | 564 // Update the site of the SiteInstance if it doesn't have one yet, unless |
567 // assigning a site is not necessary for this URL. In that case, the | 565 // assigning a site is not necessary for this URL. In that case, the |
568 // SiteInstance can still be considered unused until a navigation to a real | 566 // SiteInstance can still be considered unused until a navigation to a real |
569 // page. | 567 // page. |
570 SiteInstanceImpl* site_instance = | 568 SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); |
571 static_cast<SiteInstanceImpl*>(render_frame_host->GetSiteInstance()); | |
572 if (!site_instance->HasSite() && | 569 if (!site_instance->HasSite() && |
573 ShouldAssignSiteForURL(params.url)) { | 570 ShouldAssignSiteForURL(params.url)) { |
574 site_instance->SetSite(params.url); | 571 site_instance->SetSite(params.url); |
575 } | 572 } |
576 | 573 |
577 // Need to update MIME type here because it's referred to in | 574 // Need to update MIME type here because it's referred to in |
578 // UpdateNavigationCommands() called by RendererDidNavigate() to | 575 // UpdateNavigationCommands() called by RendererDidNavigate() to |
579 // determine whether or not to enable the encoding menu. | 576 // determine whether or not to enable the encoding menu. |
580 // It's updated only for the main frame. For a subframe, | 577 // It's updated only for the main frame. For a subframe, |
581 // RenderView::UpdateURL does not set params.contents_mime_type. | 578 // RenderView::UpdateURL does not set params.contents_mime_type. |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 978 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
982 time_to_commit); | 979 time_to_commit); |
983 UMA_HISTOGRAM_TIMES( | 980 UMA_HISTOGRAM_TIMES( |
984 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 981 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
985 time_to_network); | 982 time_to_network); |
986 } | 983 } |
987 navigation_data_.reset(); | 984 navigation_data_.reset(); |
988 } | 985 } |
989 | 986 |
990 } // namespace content | 987 } // namespace content |
OLD | NEW |