| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
| 4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "platform/HTTPNames.h" | 32 #include "platform/HTTPNames.h" |
| 33 #include "platform/loader/fetch/ResourceLoadPriority.h" | 33 #include "platform/loader/fetch/ResourceLoadPriority.h" |
| 34 #include "platform/network/EncodedFormData.h" | 34 #include "platform/network/EncodedFormData.h" |
| 35 #include "platform/network/HTTPHeaderMap.h" | 35 #include "platform/network/HTTPHeaderMap.h" |
| 36 #include "platform/network/HTTPParsers.h" | 36 #include "platform/network/HTTPParsers.h" |
| 37 #include "platform/weborigin/KURL.h" | 37 #include "platform/weborigin/KURL.h" |
| 38 #include "platform/weborigin/Referrer.h" | 38 #include "platform/weborigin/Referrer.h" |
| 39 #include "platform/weborigin/SecurityOrigin.h" | 39 #include "platform/weborigin/SecurityOrigin.h" |
| 40 #include "platform/wtf/RefCounted.h" | 40 #include "platform/wtf/RefCounted.h" |
| 41 #include "public/platform/WebAddressSpace.h" | 41 #include "public/platform/WebAddressSpace.h" |
| 42 #include "public/platform/WebCachePolicy.h" |
| 42 #include "public/platform/WebURLRequest.h" | 43 #include "public/platform/WebURLRequest.h" |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 enum class WebCachePolicy; | |
| 47 | |
| 48 enum class ResourceRequestBlockedReason { | 47 enum class ResourceRequestBlockedReason { |
| 49 CSP, | 48 CSP, |
| 50 kMixedContent, | 49 kMixedContent, |
| 51 kOrigin, | 50 kOrigin, |
| 52 kInspector, | 51 kInspector, |
| 53 kSubresourceFilter, | 52 kSubresourceFilter, |
| 54 kOther, | 53 kOther, |
| 55 kNone | 54 kNone |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 enum InputToLoadPerfMetricReportPolicy { | 57 enum InputToLoadPerfMetricReportPolicy : uint8_t { |
| 59 kNoReport, // Don't report metrics for this ResourceRequest. | 58 kNoReport, // Don't report metrics for this ResourceRequest. |
| 60 kReportLink, // Report metrics for this request as initiated by a link click. | 59 kReportLink, // Report metrics for this request as initiated by a link click. |
| 61 kReportIntent, // Report metrics for this request as initiated by an intent. | 60 kReportIntent, // Report metrics for this request as initiated by an intent. |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 struct CrossThreadResourceRequestData; | 63 struct CrossThreadResourceRequestData; |
| 65 | 64 |
| 66 class PLATFORM_EXPORT ResourceRequest final { | 65 class PLATFORM_EXPORT ResourceRequest final { |
| 67 DISALLOW_NEW(); | 66 DISALLOW_NEW(); |
| 68 | 67 |
| 69 public: | 68 public: |
| 70 enum class RedirectStatus { kFollowedRedirect, kNoRedirect }; | 69 enum class RedirectStatus : uint8_t { kFollowedRedirect, kNoRedirect }; |
| 71 | 70 |
| 72 class ExtraData : public RefCounted<ExtraData> { | 71 class ExtraData : public RefCounted<ExtraData> { |
| 73 public: | 72 public: |
| 74 virtual ~ExtraData() {} | 73 virtual ~ExtraData() {} |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 ResourceRequest(); | 76 ResourceRequest(); |
| 78 explicit ResourceRequest(const String& url_string); | 77 explicit ResourceRequest(const String& url_string); |
| 79 explicit ResourceRequest(const KURL&); | 78 explicit ResourceRequest(const KURL&); |
| 80 explicit ResourceRequest(CrossThreadResourceRequestData*); | 79 explicit ResourceRequest(CrossThreadResourceRequestData*); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 is_same_document_navigation_ = is_same_document; | 327 is_same_document_navigation_ = is_same_document; |
| 329 } | 328 } |
| 330 bool IsSameDocumentNavigation() const { return is_same_document_navigation_; } | 329 bool IsSameDocumentNavigation() const { return is_same_document_navigation_; } |
| 331 | 330 |
| 332 private: | 331 private: |
| 333 const CacheControlHeader& GetCacheControlHeader() const; | 332 const CacheControlHeader& GetCacheControlHeader() const; |
| 334 | 333 |
| 335 bool NeedsHTTPOrigin() const; | 334 bool NeedsHTTPOrigin() const; |
| 336 | 335 |
| 337 KURL url_; | 336 KURL url_; |
| 338 WebCachePolicy cache_policy_; | |
| 339 double timeout_interval_; // 0 is a magic value for platform default on | 337 double timeout_interval_; // 0 is a magic value for platform default on |
| 340 // platforms that have one. | 338 // platforms that have one. |
| 341 KURL first_party_for_cookies_; | 339 KURL first_party_for_cookies_; |
| 342 RefPtr<SecurityOrigin> requestor_origin_; | 340 RefPtr<SecurityOrigin> requestor_origin_; |
| 343 AtomicString http_method_; | 341 AtomicString http_method_; |
| 344 HTTPHeaderMap http_header_fields_; | 342 HTTPHeaderMap http_header_fields_; |
| 345 RefPtr<EncodedFormData> http_body_; | 343 RefPtr<EncodedFormData> http_body_; |
| 346 RefPtr<EncodedFormData> attached_credential_; | 344 RefPtr<EncodedFormData> attached_credential_; |
| 347 bool allow_stored_credentials_ : 1; | 345 bool allow_stored_credentials_ : 1; |
| 348 bool report_upload_progress_ : 1; | 346 bool report_upload_progress_ : 1; |
| 349 bool report_raw_headers_ : 1; | 347 bool report_raw_headers_ : 1; |
| 350 bool has_user_gesture_ : 1; | 348 bool has_user_gesture_ : 1; |
| 351 bool download_to_file_ : 1; | 349 bool download_to_file_ : 1; |
| 352 bool use_stream_on_response_ : 1; | 350 bool use_stream_on_response_ : 1; |
| 353 bool keepalive_ : 1; | 351 bool keepalive_ : 1; |
| 354 bool should_reset_app_cache_ : 1; | 352 bool should_reset_app_cache_ : 1; |
| 353 WebCachePolicy cache_policy_; |
| 355 WebURLRequest::ServiceWorkerMode service_worker_mode_; | 354 WebURLRequest::ServiceWorkerMode service_worker_mode_; |
| 356 ResourceLoadPriority priority_; | 355 ResourceLoadPriority priority_; |
| 357 int intra_priority_value_; | 356 int intra_priority_value_; |
| 358 int requestor_id_; | 357 int requestor_id_; |
| 359 int requestor_process_id_; | 358 int requestor_process_id_; |
| 360 int app_cache_host_id_; | 359 int app_cache_host_id_; |
| 360 WebURLRequest::PreviewsState previews_state_; |
| 361 RefPtr<ExtraData> extra_data_; | 361 RefPtr<ExtraData> extra_data_; |
| 362 WebURLRequest::RequestContext request_context_; | 362 WebURLRequest::RequestContext request_context_; |
| 363 WebURLRequest::FrameType frame_type_; | 363 WebURLRequest::FrameType frame_type_; |
| 364 WebURLRequest::FetchRequestMode fetch_request_mode_; | 364 WebURLRequest::FetchRequestMode fetch_request_mode_; |
| 365 WebURLRequest::FetchCredentialsMode fetch_credentials_mode_; | 365 WebURLRequest::FetchCredentialsMode fetch_credentials_mode_; |
| 366 WebURLRequest::FetchRedirectMode fetch_redirect_mode_; | 366 WebURLRequest::FetchRedirectMode fetch_redirect_mode_; |
| 367 WebURLRequest::PreviewsState previews_state_; | |
| 368 ReferrerPolicy referrer_policy_; | 367 ReferrerPolicy referrer_policy_; |
| 369 bool did_set_http_referrer_; | 368 bool did_set_http_referrer_; |
| 370 bool check_for_browser_side_navigation_; | 369 bool check_for_browser_side_navigation_; |
| 371 double ui_start_time_; | 370 double ui_start_time_; |
| 372 bool is_external_request_; | 371 bool is_external_request_; |
| 373 WebURLRequest::LoadingIPCType loading_ipc_type_; | 372 WebURLRequest::LoadingIPCType loading_ipc_type_; |
| 374 bool is_same_document_navigation_; | 373 bool is_same_document_navigation_; |
| 375 InputToLoadPerfMetricReportPolicy input_perf_metric_report_policy_; | 374 InputToLoadPerfMetricReportPolicy input_perf_metric_report_policy_; |
| 375 RedirectStatus redirect_status_; |
| 376 | 376 |
| 377 mutable CacheControlHeader cache_control_header_cache_; | 377 mutable CacheControlHeader cache_control_header_cache_; |
| 378 | 378 |
| 379 static double default_timeout_interval_; | 379 static double default_timeout_interval_; |
| 380 | 380 |
| 381 RedirectStatus redirect_status_; | |
| 382 | |
| 383 double navigation_start_ = 0; | 381 double navigation_start_ = 0; |
| 384 }; | 382 }; |
| 385 | 383 |
| 386 struct CrossThreadResourceRequestData { | 384 struct CrossThreadResourceRequestData { |
| 387 WTF_MAKE_NONCOPYABLE(CrossThreadResourceRequestData); | 385 WTF_MAKE_NONCOPYABLE(CrossThreadResourceRequestData); |
| 388 USING_FAST_MALLOC(CrossThreadResourceRequestData); | 386 USING_FAST_MALLOC(CrossThreadResourceRequestData); |
| 389 | 387 |
| 390 public: | 388 public: |
| 391 CrossThreadResourceRequestData() {} | 389 CrossThreadResourceRequestData() {} |
| 392 KURL url_; | 390 KURL url_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 double ui_start_time_; | 423 double ui_start_time_; |
| 426 bool is_external_request_; | 424 bool is_external_request_; |
| 427 WebURLRequest::LoadingIPCType loading_ipc_type_; | 425 WebURLRequest::LoadingIPCType loading_ipc_type_; |
| 428 InputToLoadPerfMetricReportPolicy input_perf_metric_report_policy_; | 426 InputToLoadPerfMetricReportPolicy input_perf_metric_report_policy_; |
| 429 ResourceRequest::RedirectStatus redirect_status_; | 427 ResourceRequest::RedirectStatus redirect_status_; |
| 430 }; | 428 }; |
| 431 | 429 |
| 432 } // namespace blink | 430 } // namespace blink |
| 433 | 431 |
| 434 #endif // ResourceRequest_h | 432 #endif // ResourceRequest_h |
| OLD | NEW |