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

Side by Side Diff: content/common/navigation_params.cc

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/navigation_params.h" 5 #include "content/common/navigation_params.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "content/common/service_worker/service_worker_types.h"
9 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 // PlzNavigate 14 // PlzNavigate
14 bool ShouldMakeNetworkRequestForURL(const GURL& url) { 15 bool ShouldMakeNetworkRequestForURL(const GURL& url) {
15 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 16 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
16 switches::kEnableBrowserSideNavigation)); 17 switches::kEnableBrowserSideNavigation));
17 18
18 // Data URLs, Javascript URLs and about:blank should not send a request to the 19 // Data URLs, Javascript URLs and about:blank should not send a request to the
19 // network stack. 20 // network stack.
20 // TODO(clamy): same document navigations should not send requests to the 21 // TODO(clamy): same document navigations should not send requests to the
21 // network stack. Neither should pushState/popState. 22 // network stack. Neither should pushState/popState.
22 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) && 23 return !url.SchemeIs(url::kDataScheme) && url != GURL(url::kAboutBlankURL) &&
23 !url.SchemeIs(url::kJavaScriptScheme); 24 !url.SchemeIs(url::kJavaScriptScheme);
24 } 25 }
25 26
26 CommonNavigationParams::CommonNavigationParams() 27 CommonNavigationParams::CommonNavigationParams()
27 : transition(ui::PAGE_TRANSITION_LINK), 28 : transition(ui::PAGE_TRANSITION_LINK),
28 navigation_type(FrameMsg_Navigate_Type::NORMAL), 29 navigation_type(FrameMsg_Navigate_Type::NORMAL),
29 allow_download(true), 30 allow_download(true),
30 should_replace_current_entry(false), 31 should_replace_current_entry(false),
31 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT) { 32 report_type(FrameMsg_UILoadMetricsReportType::NO_REPORT),
33 service_worker_provider_id(kInvalidServiceWorkerProviderId) {
32 } 34 }
33 35
34 CommonNavigationParams::CommonNavigationParams( 36 CommonNavigationParams::CommonNavigationParams(
35 const GURL& url, 37 const GURL& url,
36 const Referrer& referrer, 38 const Referrer& referrer,
37 ui::PageTransition transition, 39 ui::PageTransition transition,
38 FrameMsg_Navigate_Type::Value navigation_type, 40 FrameMsg_Navigate_Type::Value navigation_type,
39 bool allow_download, 41 bool allow_download,
40 bool should_replace_current_entry, 42 bool should_replace_current_entry,
41 base::TimeTicks ui_timestamp, 43 base::TimeTicks ui_timestamp,
42 FrameMsg_UILoadMetricsReportType::Value report_type, 44 FrameMsg_UILoadMetricsReportType::Value report_type,
43 const GURL& base_url_for_data_url, 45 const GURL& base_url_for_data_url,
44 const GURL& history_url_for_data_url) 46 const GURL& history_url_for_data_url,
47 int service_worker_provider_id)
45 : url(url), 48 : url(url),
46 referrer(referrer), 49 referrer(referrer),
47 transition(transition), 50 transition(transition),
48 navigation_type(navigation_type), 51 navigation_type(navigation_type),
49 allow_download(allow_download), 52 allow_download(allow_download),
50 should_replace_current_entry(should_replace_current_entry), 53 should_replace_current_entry(should_replace_current_entry),
51 ui_timestamp(ui_timestamp), 54 ui_timestamp(ui_timestamp),
52 report_type(report_type), 55 report_type(report_type),
53 base_url_for_data_url(base_url_for_data_url), 56 base_url_for_data_url(base_url_for_data_url),
54 history_url_for_data_url(history_url_for_data_url) { 57 history_url_for_data_url(history_url_for_data_url),
58 service_worker_provider_id(service_worker_provider_id) {
55 } 59 }
56 60
57 CommonNavigationParams::~CommonNavigationParams() { 61 CommonNavigationParams::~CommonNavigationParams() {
58 } 62 }
59 63
60 BeginNavigationParams::BeginNavigationParams() 64 BeginNavigationParams::BeginNavigationParams()
61 : load_flags(0), has_user_gesture(false) { 65 : load_flags(0),
66 has_user_gesture(false),
67 skip_service_worker(false),
68 request_context_type(REQUEST_CONTEXT_TYPE_LOCATION),
69 frame_type(REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL) {
62 } 70 }
63 71
64 BeginNavigationParams::BeginNavigationParams(std::string method, 72 BeginNavigationParams::BeginNavigationParams(
65 std::string headers, 73 std::string method,
66 int load_flags, 74 std::string headers,
67 bool has_user_gesture) 75 int load_flags,
76 bool has_user_gesture,
77 bool skip_service_worker,
78 RequestContextType request_context_type,
79 RequestContextFrameType frame_type)
68 : method(method), 80 : method(method),
69 headers(headers), 81 headers(headers),
70 load_flags(load_flags), 82 load_flags(load_flags),
71 has_user_gesture(has_user_gesture) { 83 has_user_gesture(has_user_gesture),
84 skip_service_worker(skip_service_worker),
85 request_context_type(request_context_type),
86 frame_type(frame_type) {
72 } 87 }
73 88
74 StartNavigationParams::StartNavigationParams() 89 StartNavigationParams::StartNavigationParams()
75 : is_post(false), 90 : is_post(false),
76 #if defined(OS_ANDROID) 91 #if defined(OS_ANDROID)
77 has_user_gesture(false), 92 has_user_gesture(false),
78 #endif 93 #endif
79 transferred_request_child_id(-1), 94 transferred_request_child_id(-1),
80 transferred_request_request_id(-1) { 95 transferred_request_request_id(-1) {
81 } 96 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const RequestNavigationParams& request_params) 175 const RequestNavigationParams& request_params)
161 : common_params(common_params), 176 : common_params(common_params),
162 start_params(start_params), 177 start_params(start_params),
163 request_params(request_params) { 178 request_params(request_params) {
164 } 179 }
165 180
166 NavigationParams::~NavigationParams() { 181 NavigationParams::~NavigationParams() {
167 } 182 }
168 183
169 } // namespace content 184 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698