OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 ModuleScriptFetchRequest_h | |
6 #define ModuleScriptFetchRequest_h | |
7 | |
8 #include "platform/loader/fetch/ResourceLoaderOptions.h" | |
9 #include "platform/weborigin/KURL.h" | |
10 #include "platform/weborigin/Referrer.h" | |
11 #include "public/platform/WebURLRequest.h" | |
12 #include "wtf/text/WTFString.h" | |
13 | |
14 namespace blink { | |
15 | |
16 // A ModuleScriptFetchRequest is a "parameter object" for | |
17 // Modulator::fetch{,New}SingleModule to avoid the methods having too many | |
18 // arguments. | |
19 // In terms of spec, a ModuleScriptFetchRequest carries most of the arguments | |
20 // for "fetch a single module script" algorithm: | |
21 // https://html.spec.whatwg.org/#fetch-a-single-module-script | |
22 class ModuleScriptFetchRequest final { | |
23 STACK_ALLOCATED(); | |
24 | |
25 public: | |
26 ModuleScriptFetchRequest(const KURL& url, | |
27 const String& nonce, | |
28 ParserDisposition parserState, | |
29 WebURLRequest::FetchCredentialsMode credentialsMode) | |
30 : ModuleScriptFetchRequest(url, | |
31 nonce, | |
32 parserState, | |
33 credentialsMode, | |
34 nullAtom) {} | |
yhirano
2017/01/30 18:04:28
Can you use Referrer::noReferrer() instead?
kouhei (in TOK)
2017/01/30 18:08:24
Done.
| |
35 ~ModuleScriptFetchRequest() = default; | |
36 | |
37 const KURL& url() const { return m_url; } | |
38 const String& nonce() const { return m_nonce; } | |
39 const ParserDisposition& parserState() const { return m_parserState; } | |
40 WebURLRequest::FetchCredentialsMode credentialsMode() const { | |
41 return m_credentialsMode; | |
42 } | |
43 const AtomicString& referrer() const { return m_referrer; } | |
44 | |
45 private: | |
46 // Referrer is set only for internal module script fetch algorithms triggered | |
47 // from ModuleTreeLinker to fetch descendant module scripts. | |
48 friend class ModuleTreeLinker; | |
49 ModuleScriptFetchRequest(const KURL& url, | |
50 const String& nonce, | |
51 ParserDisposition parserState, | |
52 WebURLRequest::FetchCredentialsMode credentialsMode, | |
53 const String& referrer) | |
54 : m_url(url), | |
55 m_nonce(nonce), | |
56 m_parserState(parserState), | |
57 m_credentialsMode(credentialsMode), | |
58 m_referrer(referrer) {} | |
59 | |
60 const KURL m_url; | |
61 const String m_nonce; | |
62 const ParserDisposition m_parserState; | |
63 const WebURLRequest::FetchCredentialsMode m_credentialsMode; | |
64 const AtomicString m_referrer; | |
65 }; | |
66 | |
67 } // namespace blink | |
68 | |
69 #endif | |
OLD | NEW |