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

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) {
62 } 69 }
63 70
64 BeginNavigationParams::BeginNavigationParams(std::string method, 71 BeginNavigationParams::BeginNavigationParams(
65 std::string headers, 72 std::string method,
66 int load_flags, 73 std::string headers,
67 bool has_user_gesture) 74 int load_flags,
75 bool has_user_gesture,
76 bool skip_service_worker,
77 RequestContextType request_context_type)
68 : method(method), 78 : method(method),
69 headers(headers), 79 headers(headers),
70 load_flags(load_flags), 80 load_flags(load_flags),
71 has_user_gesture(has_user_gesture) { 81 has_user_gesture(has_user_gesture),
82 skip_service_worker(skip_service_worker),
83 request_context_type(request_context_type) {
72 } 84 }
73 85
74 StartNavigationParams::StartNavigationParams() 86 StartNavigationParams::StartNavigationParams()
75 : is_post(false), 87 : is_post(false),
76 #if defined(OS_ANDROID) 88 #if defined(OS_ANDROID)
77 has_user_gesture(false), 89 has_user_gesture(false),
78 #endif 90 #endif
79 transferred_request_child_id(-1), 91 transferred_request_child_id(-1),
80 transferred_request_request_id(-1) { 92 transferred_request_request_id(-1) {
81 } 93 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const RequestNavigationParams& request_params) 172 const RequestNavigationParams& request_params)
161 : common_params(common_params), 173 : common_params(common_params),
162 start_params(start_params), 174 start_params(start_params),
163 request_params(request_params) { 175 request_params(request_params) {
164 } 176 }
165 177
166 NavigationParams::~NavigationParams() { 178 NavigationParams::~NavigationParams() {
167 } 179 }
168 180
169 } // namespace content 181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698