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

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 3 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
OLDNEW
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"
11 #include "content/browser/frame_host/frame_tree_node.h" 11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 12 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_entry_impl.h" 13 #include "content/browser/frame_host/navigation_entry_impl.h"
14 #include "content/browser/frame_host/navigation_handle_impl.h" 14 #include "content/browser/frame_host/navigation_handle_impl.h"
15 #include "content/browser/frame_host/navigation_request.h" 15 #include "content/browser/frame_host/navigation_request.h"
16 #include "content/browser/frame_host/navigation_request_info.h" 16 #include "content/browser/frame_host/navigation_request_info.h"
17 #include "content/browser/frame_host/navigator_delegate.h" 17 #include "content/browser/frame_host/navigator_delegate.h"
18 #include "content/browser/frame_host/render_frame_host_impl.h" 18 #include "content/browser/frame_host/render_frame_host_impl.h"
19 #include "content/browser/renderer_host/render_view_host_impl.h" 19 #include "content/browser/renderer_host/render_view_host_impl.h"
20 #include "content/browser/site_instance_impl.h" 20 #include "content/browser/site_instance_impl.h"
21 #include "content/browser/webui/web_ui_controller_factory_registry.h" 21 #include "content/browser/webui/web_ui_controller_factory_registry.h"
22 #include "content/browser/webui/web_ui_impl.h" 22 #include "content/browser/webui/web_ui_impl.h"
23 #include "content/common/frame_messages.h" 23 #include "content/common/frame_messages.h"
24 #include "content/common/navigation_params.h" 24 #include "content/common/navigation_params.h"
25 #include "content/common/service_worker/service_worker_types.h"
25 #include "content/common/site_isolation_policy.h" 26 #include "content/common/site_isolation_policy.h"
26 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
27 #include "content/public/browser/browser_context.h" 28 #include "content/public/browser/browser_context.h"
28 #include "content/public/browser/content_browser_client.h" 29 #include "content/public/browser/content_browser_client.h"
29 #include "content/public/browser/global_request_id.h" 30 #include "content/public/browser/global_request_id.h"
30 #include "content/public/browser/invalidate_type.h" 31 #include "content/public/browser/invalidate_type.h"
31 #include "content/public/browser/navigation_controller.h" 32 #include "content/public/browser/navigation_controller.h"
32 #include "content/public/browser/navigation_details.h" 33 #include "content/public/browser/navigation_details.h"
33 #include "content/public/browser/page_navigator.h" 34 #include "content/public/browser/page_navigator.h"
34 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 entry.transferred_global_request_id().child_id == 329 entry.transferred_global_request_id().child_id ==
329 dest_render_frame_host->GetProcess()->GetID(); 330 dest_render_frame_host->GetProcess()->GetID();
330 if (!is_transfer_to_same) { 331 if (!is_transfer_to_same) {
331 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, 332 navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url,
332 entry.restore_type())); 333 entry.restore_type()));
333 // Create the navigation parameters. 334 // Create the navigation parameters.
334 FrameMsg_Navigate_Type::Value navigation_type = 335 FrameMsg_Navigate_Type::Value navigation_type =
335 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); 336 GetNavigationType(controller_->GetBrowserContext(), entry, reload_type);
336 dest_render_frame_host->Navigate( 337 dest_render_frame_host->Navigate(
337 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, 338 entry.ConstructCommonNavigationParams(dest_url, dest_referrer,
338 frame_entry, navigation_type), 339 frame_entry, navigation_type,
340 kInvalidServiceWorkerProviderId),
339 entry.ConstructStartNavigationParams(), 341 entry.ConstructStartNavigationParams(),
340 entry.ConstructRequestNavigationParams( 342 entry.ConstructRequestNavigationParams(
341 frame_entry, navigation_start, is_same_document_history_load, 343 frame_entry, navigation_start, is_same_document_history_load,
342 frame_tree_node->has_committed_real_load(), 344 frame_tree_node->has_committed_real_load(),
343 controller_->GetPendingEntryIndex() == -1, 345 controller_->GetPendingEntryIndex() == -1,
344 controller_->GetIndexOfEntry(&entry), 346 controller_->GetIndexOfEntry(&entry),
345 controller_->GetLastCommittedEntryIndex(), 347 controller_->GetLastCommittedEntryIndex(),
346 controller_->GetEntryCount())); 348 controller_->GetEntryCount()));
347 } else { 349 } else {
348 // No need to navigate again. Just resume the deferred request. 350 // No need to navigate again. Just resume the deferred request.
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 render_frame_host->render_view_host()->GetRoutingID())); 736 render_frame_host->render_view_host()->GetRoutingID()));
735 } 737 }
736 738
737 CheckWebUIRendererDoesNotDisplayNormalURL( 739 CheckWebUIRendererDoesNotDisplayNormalURL(
738 render_frame_host, navigation_request->common_params().url); 740 render_frame_host, navigation_request->common_params().url);
739 741
740 navigation_request->TransferNavigationHandleOwnership(render_frame_host); 742 navigation_request->TransferNavigationHandleOwnership(render_frame_host);
741 render_frame_host->CommitNavigation(response, body.Pass(), 743 render_frame_host->CommitNavigation(response, body.Pass(),
742 navigation_request->common_params(), 744 navigation_request->common_params(),
743 navigation_request->request_params()); 745 navigation_request->request_params());
744
745 } 746 }
746 747
747 // PlzNavigate 748 // PlzNavigate
748 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, 749 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node,
749 bool has_stale_copy_in_cache, 750 bool has_stale_copy_in_cache,
750 int error_code) { 751 int error_code) {
751 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 752 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
752 switches::kEnableBrowserSideNavigation)); 753 switches::kEnableBrowserSideNavigation));
753 754
754 NavigationRequest* navigation_request = frame_tree_node->navigation_request(); 755 NavigationRequest* navigation_request = frame_tree_node->navigation_request();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 entry->set_should_replace_entry(pending_entry->should_replace_entry()); 944 entry->set_should_replace_entry(pending_entry->should_replace_entry());
944 entry->SetRedirectChain(pending_entry->GetRedirectChain()); 945 entry->SetRedirectChain(pending_entry->GetRedirectChain());
945 } 946 }
946 controller_->SetPendingEntry(entry.Pass()); 947 controller_->SetPendingEntry(entry.Pass());
947 if (delegate_) 948 if (delegate_)
948 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 949 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
949 } 950 }
950 } 951 }
951 952
952 } // namespace content 953 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698