1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_FETCH_CLIENT_SETTINGS_OBJECT_IMPL_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_FETCH_CLIENT_SETTINGS_OBJECT_IMPL_H_ 7 8 #include "services/network/public/mojom/referrer_policy.mojom-blink-forward.h" 9 #include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-blink-forward.h" 10 #include "third_party/blink/renderer/core/core_export.h" 11 #include "third_party/blink/renderer/platform/heap/member.h" 12 #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h" 13 #include "third_party/blink/renderer/platform/loader/fetch/https_state.h" 14 #include "third_party/blink/renderer/platform/weborigin/kurl.h" 15 #include "third_party/blink/renderer/platform/weborigin/security_origin.h" 16 #include "third_party/blink/renderer/platform/wtf/cross_thread_copier.h" 17 18 namespace blink { 19 20 class ExecutionContext; 21 22 // This is an implementation of FetchClientSettingsObject. As opposed to 23 // FetchClientSettingsObjectSnapshot, this refers to up-to-date values of the 24 // settings object. 25 // 26 // This class should be used for resource loading other than main worker 27 // (worklet) scripts. For the main scripts, FetchClientSettingsObjectSnapshot 28 // should be used. See the class level comments on that class. 29 class CORE_EXPORT FetchClientSettingsObjectImpl final 30 : public FetchClientSettingsObject { 31 public: 32 explicit FetchClientSettingsObjectImpl(ExecutionContext&); 33 ~FetchClientSettingsObjectImpl() override = default; 34 35 const KURL& GlobalObjectUrl() const override; 36 const KURL& BaseUrl() const override; 37 const SecurityOrigin* GetSecurityOrigin() const override; 38 network::mojom::ReferrerPolicy GetReferrerPolicy() const override; 39 const String GetOutgoingReferrer() const override; 40 41 HttpsState GetHttpsState() const override; 42 43 AllowedByNosniff::MimeTypeCheck MimeTypeCheckForClassicWorkerScript() 44 const override; 45 46 network::mojom::IPAddressSpace GetAddressSpace() const override; 47 48 mojom::blink::InsecureRequestPolicy GetInsecureRequestsPolicy() 49 const override; 50 const InsecureNavigationsSet& GetUpgradeInsecureNavigationsSet() 51 const override; 52 53 void Trace(Visitor* visitor) override; 54 55 private: 56 Member<ExecutionContext> execution_context_; 57 }; 58 59 } // namespace blink 60 61 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_SCRIPT_FETCH_CLIENT_SETTINGS_OBJECT_IMPL_H_ 62