Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 98 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 99 #include "net/base/upload_data_stream.h" | 99 #include "net/base/upload_data_stream.h" |
| 100 #include "net/cert/cert_status_flags.h" | 100 #include "net/cert/cert_status_flags.h" |
| 101 #include "net/cookies/cookie_monster.h" | 101 #include "net/cookies/cookie_monster.h" |
| 102 #include "net/http/http_request_headers.h" | 102 #include "net/http/http_request_headers.h" |
| 103 #include "net/http/http_response_headers.h" | 103 #include "net/http/http_response_headers.h" |
| 104 #include "net/http/http_response_info.h" | 104 #include "net/http/http_response_info.h" |
| 105 #include "net/log/net_log_with_source.h" | 105 #include "net/log/net_log_with_source.h" |
| 106 #include "net/ssl/client_cert_store.h" | 106 #include "net/ssl/client_cert_store.h" |
| 107 #include "net/ssl/ssl_cert_request_info.h" | 107 #include "net/ssl/ssl_cert_request_info.h" |
| 108 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 108 #include "net/url_request/url_request.h" | 109 #include "net/url_request/url_request.h" |
| 109 #include "net/url_request/url_request_context.h" | 110 #include "net/url_request/url_request_context.h" |
| 110 #include "net/url_request/url_request_job_factory.h" | 111 #include "net/url_request/url_request_job_factory.h" |
| 111 #include "ppapi/features/features.h" | 112 #include "ppapi/features/features.h" |
| 112 #include "storage/browser/blob/blob_data_handle.h" | 113 #include "storage/browser/blob/blob_data_handle.h" |
| 113 #include "storage/browser/blob/blob_storage_context.h" | 114 #include "storage/browser/blob/blob_storage_context.h" |
| 114 #include "storage/browser/blob/blob_url_request_job_factory.h" | 115 #include "storage/browser/blob/blob_url_request_job_factory.h" |
| 115 #include "storage/browser/blob/shareable_file_reference.h" | 116 #include "storage/browser/blob/shareable_file_reference.h" |
| 116 #include "storage/browser/fileapi/file_permission_policy.h" | 117 #include "storage/browser/fileapi/file_permission_policy.h" |
| 117 #include "storage/browser/fileapi/file_system_context.h" | 118 #include "storage/browser/fileapi/file_system_context.h" |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 // Allow the observer to block/handle the request. | 1197 // Allow the observer to block/handle the request. |
| 1197 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method, | 1198 if (delegate_ && !delegate_->ShouldBeginRequest(request_data.method, |
| 1198 request_data.url, | 1199 request_data.url, |
| 1199 request_data.resource_type, | 1200 request_data.resource_type, |
| 1200 resource_context)) { | 1201 resource_context)) { |
| 1201 AbortRequestBeforeItStarts(requester_info->filter(), sync_result_handler, | 1202 AbortRequestBeforeItStarts(requester_info->filter(), sync_result_handler, |
| 1202 request_id, std::move(url_loader_client)); | 1203 request_id, std::move(url_loader_client)); |
| 1203 return; | 1204 return; |
| 1204 } | 1205 } |
| 1205 | 1206 |
| 1207 net::NetworkTrafficAnnotationTag traffic_annotation = | |
| 1208 net::DefineNetworkTrafficAnnotation("...", R"( | |
| 1209 semantics { | |
| 1210 sender: "..." | |
|
mmenke
2017/04/27 12:24:09
Renderer Process, and occasionally the Browser Pro
Ramin Halavati
2017/04/27 12:38:16
Can we call it "Resource Dispatcher Host"? The nam
mmenke
2017/04/27 15:20:05
Sure, if it's not supposed to have semantic meanin
Ramin Halavati
2017/04/28 05:40:36
I think that is more covered in |description| fiel
| |
| 1211 description: "..." | |
|
mmenke
2017/04/27 12:24:10
Navigation-initiated request or renderer process i
Ramin Halavati
2017/04/27 12:38:17
Done.
| |
| 1212 trigger: "..." | |
|
mmenke
2017/04/27 12:24:09
Navigating to a URL or downloading a file. A webp
Ramin Halavati
2017/04/27 12:38:17
Done.
| |
| 1213 data: "..." | |
|
mmenke
2017/04/27 12:24:09
Anything the initiator wants to send.
Ramin Halavati
2017/04/27 12:38:16
Done.
| |
| 1214 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL | |
|
mmenke
2017/04/27 12:24:09
WEBSITE, GOOGLE_OWNED_SERVICE (For things like the
Ramin Halavati
2017/04/27 12:38:17
I will set it to OTHER as it supersedes the rest.
| |
| 1215 } | |
| 1216 policy { | |
| 1217 cookies_allowed: false/true | |
|
mmenke
2017/04/27 12:24:09
true
Ramin Halavati
2017/04/27 12:38:17
Done.
| |
| 1218 cookies_store: "..." | |
|
mmenke
2017/04/27 12:24:09
Both the main cookie store and per-app cookie stor
Ramin Halavati
2017/04/27 12:38:17
Done.
| |
| 1219 setting: "..." | |
|
mmenke
2017/04/27 12:24:10
None. If you disable these requests, Chrome will
Ramin Halavati
2017/04/27 12:38:16
Done.
| |
| 1220 chrome_policy { | |
| 1221 [POLICY_NAME] { | |
| 1222 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
| 1223 [POLICY_NAME]: ... //(value to disable it) | |
|
mmenke
2017/04/27 12:24:09
None, per above.
Ramin Halavati
2017/04/27 12:38:17
Done.
| |
| 1224 } | |
| 1225 } | |
| 1226 policy_exception_justification: "..." | |
|
mmenke
2017/04/27 12:24:09
Without these requests, Chrome will be unable to l
Ramin Halavati
2017/04/27 12:38:16
Done.
| |
| 1227 })"); | |
| 1206 // Construct the request. | 1228 // Construct the request. |
| 1207 std::unique_ptr<net::URLRequest> new_request = request_context->CreateRequest( | 1229 std::unique_ptr<net::URLRequest> new_request = request_context->CreateRequest( |
| 1208 is_navigation_stream_request ? request_data.resource_body_stream_url | 1230 is_navigation_stream_request ? request_data.resource_body_stream_url |
| 1209 : request_data.url, | 1231 : request_data.url, |
| 1210 request_data.priority, nullptr); | 1232 request_data.priority, nullptr, traffic_annotation); |
| 1211 | 1233 |
| 1212 // Log that this request is a service worker navigation preload request here, | 1234 // Log that this request is a service worker navigation preload request here, |
| 1213 // since navigation preload machinery has no access to netlog. | 1235 // since navigation preload machinery has no access to netlog. |
| 1214 // TODO(falken): Figure out how mojom::URLLoaderClient can | 1236 // TODO(falken): Figure out how mojom::URLLoaderClient can |
| 1215 // access the request's netlog. | 1237 // access the request's netlog. |
| 1216 if (requester_info->IsNavigationPreload()) { | 1238 if (requester_info->IsNavigationPreload()) { |
| 1217 new_request->net_log().AddEvent( | 1239 new_request->net_log().AddEvent( |
| 1218 net::NetLogEventType::SERVICE_WORKER_NAVIGATION_PRELOAD_REQUEST); | 1240 net::NetLogEventType::SERVICE_WORKER_NAVIGATION_PRELOAD_REQUEST); |
| 1219 } | 1241 } |
| 1220 | 1242 |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1964 load_flags |= net::LOAD_MAIN_FRAME_DEPRECATED; | 1986 load_flags |= net::LOAD_MAIN_FRAME_DEPRECATED; |
| 1965 | 1987 |
| 1966 // TODO(davidben): BuildLoadFlagsForRequest includes logic for | 1988 // TODO(davidben): BuildLoadFlagsForRequest includes logic for |
| 1967 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? | 1989 // CanSendCookiesForOrigin and CanReadRawCookies. Is this needed here? |
| 1968 | 1990 |
| 1969 // Sync loads should have maximum priority and should be the only | 1991 // Sync loads should have maximum priority and should be the only |
| 1970 // requests that have the ignore limits flag set. | 1992 // requests that have the ignore limits flag set. |
| 1971 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); | 1993 DCHECK(!(load_flags & net::LOAD_IGNORE_LIMITS)); |
| 1972 | 1994 |
| 1973 std::unique_ptr<net::URLRequest> new_request; | 1995 std::unique_ptr<net::URLRequest> new_request; |
| 1996 net::NetworkTrafficAnnotationTag traffic_annotation = | |
|
Ramin Halavati
2017/04/27 12:38:16
Should this annotation be the same as the other on
mmenke
2017/04/27 15:20:05
Yes. We could be more specific with these, but I
Ramin Halavati
2017/04/28 05:40:36
Acknowledged.
| |
| 1997 net::DefineNetworkTrafficAnnotation("...", R"( | |
| 1998 semantics { | |
| 1999 sender: "..." | |
| 2000 description: "..." | |
| 2001 trigger: "..." | |
| 2002 data: "..." | |
| 2003 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL | |
| 2004 } | |
| 2005 policy { | |
| 2006 cookies_allowed: false/true | |
| 2007 cookies_store: "..." | |
| 2008 setting: "..." | |
| 2009 chrome_policy { | |
| 2010 [POLICY_NAME] { | |
| 2011 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
| 2012 [POLICY_NAME]: ... //(value to disable it) | |
| 2013 } | |
| 2014 } | |
| 2015 policy_exception_justification: "..." | |
| 2016 })"); | |
| 1974 new_request = request_context->CreateRequest( | 2017 new_request = request_context->CreateRequest( |
| 1975 info.common_params.url, net::HIGHEST, nullptr); | 2018 info.common_params.url, net::HIGHEST, nullptr, traffic_annotation); |
| 1976 | 2019 |
| 1977 new_request->set_method(info.common_params.method); | 2020 new_request->set_method(info.common_params.method); |
| 1978 new_request->set_first_party_for_cookies( | 2021 new_request->set_first_party_for_cookies( |
| 1979 info.first_party_for_cookies); | 2022 info.first_party_for_cookies); |
| 1980 new_request->set_initiator(info.begin_params.initiator_origin); | 2023 new_request->set_initiator(info.begin_params.initiator_origin); |
| 1981 if (info.is_main_frame) { | 2024 if (info.is_main_frame) { |
| 1982 new_request->set_first_party_url_policy( | 2025 new_request->set_first_party_url_policy( |
| 1983 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); | 2026 net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); |
| 1984 } | 2027 } |
| 1985 | 2028 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2615 &throttles); | 2658 &throttles); |
| 2616 if (!throttles.empty()) { | 2659 if (!throttles.empty()) { |
| 2617 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2660 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2618 std::move(throttles))); | 2661 std::move(throttles))); |
| 2619 } | 2662 } |
| 2620 } | 2663 } |
| 2621 return handler; | 2664 return handler; |
| 2622 } | 2665 } |
| 2623 | 2666 |
| 2624 } // namespace content | 2667 } // namespace content |
| OLD | NEW |