OLD | NEW |
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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ui_timestamp(ui_timestamp), | 52 ui_timestamp(ui_timestamp), |
52 report_type(report_type), | 53 report_type(report_type), |
53 base_url_for_data_url(base_url_for_data_url), | 54 base_url_for_data_url(base_url_for_data_url), |
54 history_url_for_data_url(history_url_for_data_url) { | 55 history_url_for_data_url(history_url_for_data_url) { |
55 } | 56 } |
56 | 57 |
57 CommonNavigationParams::~CommonNavigationParams() { | 58 CommonNavigationParams::~CommonNavigationParams() { |
58 } | 59 } |
59 | 60 |
60 BeginNavigationParams::BeginNavigationParams() | 61 BeginNavigationParams::BeginNavigationParams() |
61 : load_flags(0), has_user_gesture(false) { | 62 : load_flags(0), |
| 63 has_user_gesture(false), |
| 64 skip_service_worker(false), |
| 65 request_context_type(REQUEST_CONTEXT_TYPE_HYPERLINK) { |
62 } | 66 } |
63 | 67 |
64 BeginNavigationParams::BeginNavigationParams(std::string method, | 68 BeginNavigationParams::BeginNavigationParams( |
65 std::string headers, | 69 std::string method, |
66 int load_flags, | 70 std::string headers, |
67 bool has_user_gesture) | 71 int load_flags, |
| 72 bool has_user_gesture, |
| 73 bool skip_service_worker, |
| 74 RequestContextType request_context_type) |
68 : method(method), | 75 : method(method), |
69 headers(headers), | 76 headers(headers), |
70 load_flags(load_flags), | 77 load_flags(load_flags), |
71 has_user_gesture(has_user_gesture) { | 78 has_user_gesture(has_user_gesture), |
| 79 skip_service_worker(skip_service_worker), |
| 80 request_context_type(request_context_type) { |
72 } | 81 } |
73 | 82 |
74 StartNavigationParams::StartNavigationParams() | 83 StartNavigationParams::StartNavigationParams() |
75 : is_post(false), | 84 : is_post(false), |
76 #if defined(OS_ANDROID) | 85 #if defined(OS_ANDROID) |
77 has_user_gesture(false), | 86 has_user_gesture(false), |
78 #endif | 87 #endif |
79 transferred_request_child_id(-1), | 88 transferred_request_child_id(-1), |
80 transferred_request_request_id(-1) { | 89 transferred_request_request_id(-1) { |
81 } | 90 } |
(...skipping 26 matching lines...) Expand all Loading... |
108 can_load_local_resources(false), | 117 can_load_local_resources(false), |
109 request_time(base::Time::Now()), | 118 request_time(base::Time::Now()), |
110 page_id(-1), | 119 page_id(-1), |
111 nav_entry_id(0), | 120 nav_entry_id(0), |
112 is_same_document_history_load(false), | 121 is_same_document_history_load(false), |
113 has_committed_real_load(false), | 122 has_committed_real_load(false), |
114 intended_as_new_entry(false), | 123 intended_as_new_entry(false), |
115 pending_history_list_offset(-1), | 124 pending_history_list_offset(-1), |
116 current_history_list_offset(-1), | 125 current_history_list_offset(-1), |
117 current_history_list_length(0), | 126 current_history_list_length(0), |
118 should_clear_history_list(false) { | 127 should_clear_history_list(false), |
| 128 service_worker_provider_id(kInvalidServiceWorkerProviderId) { |
119 } | 129 } |
120 | 130 |
121 RequestNavigationParams::RequestNavigationParams( | 131 RequestNavigationParams::RequestNavigationParams( |
122 bool is_overriding_user_agent, | 132 bool is_overriding_user_agent, |
123 base::TimeTicks navigation_start, | 133 base::TimeTicks navigation_start, |
124 const std::vector<GURL>& redirects, | 134 const std::vector<GURL>& redirects, |
125 bool can_load_local_resources, | 135 bool can_load_local_resources, |
126 base::Time request_time, | 136 base::Time request_time, |
127 const PageState& page_state, | 137 const PageState& page_state, |
128 int32 page_id, | 138 int32 page_id, |
129 int nav_entry_id, | 139 int nav_entry_id, |
130 bool is_same_document_history_load, | 140 bool is_same_document_history_load, |
131 bool has_committed_real_load, | 141 bool has_committed_real_load, |
132 bool intended_as_new_entry, | 142 bool intended_as_new_entry, |
133 int pending_history_list_offset, | 143 int pending_history_list_offset, |
134 int current_history_list_offset, | 144 int current_history_list_offset, |
135 int current_history_list_length, | 145 int current_history_list_length, |
136 bool should_clear_history_list) | 146 bool should_clear_history_list, |
| 147 int service_worker_provider_id) |
137 : is_overriding_user_agent(is_overriding_user_agent), | 148 : is_overriding_user_agent(is_overriding_user_agent), |
138 browser_navigation_start(navigation_start), | 149 browser_navigation_start(navigation_start), |
139 redirects(redirects), | 150 redirects(redirects), |
140 can_load_local_resources(can_load_local_resources), | 151 can_load_local_resources(can_load_local_resources), |
141 request_time(request_time), | 152 request_time(request_time), |
142 page_state(page_state), | 153 page_state(page_state), |
143 page_id(page_id), | 154 page_id(page_id), |
144 nav_entry_id(nav_entry_id), | 155 nav_entry_id(nav_entry_id), |
145 is_same_document_history_load(is_same_document_history_load), | 156 is_same_document_history_load(is_same_document_history_load), |
146 has_committed_real_load(has_committed_real_load), | 157 has_committed_real_load(has_committed_real_load), |
147 intended_as_new_entry(intended_as_new_entry), | 158 intended_as_new_entry(intended_as_new_entry), |
148 pending_history_list_offset(pending_history_list_offset), | 159 pending_history_list_offset(pending_history_list_offset), |
149 current_history_list_offset(current_history_list_offset), | 160 current_history_list_offset(current_history_list_offset), |
150 current_history_list_length(current_history_list_length), | 161 current_history_list_length(current_history_list_length), |
151 should_clear_history_list(should_clear_history_list) { | 162 should_clear_history_list(should_clear_history_list), |
| 163 service_worker_provider_id(service_worker_provider_id) { |
152 } | 164 } |
153 | 165 |
154 RequestNavigationParams::~RequestNavigationParams() { | 166 RequestNavigationParams::~RequestNavigationParams() { |
155 } | 167 } |
156 | 168 |
157 NavigationParams::NavigationParams( | 169 NavigationParams::NavigationParams( |
158 const CommonNavigationParams& common_params, | 170 const CommonNavigationParams& common_params, |
159 const StartNavigationParams& start_params, | 171 const StartNavigationParams& start_params, |
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 |
OLD | NEW |