Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/fetch/ScriptResource.h

Issue 2020223002: Refactor nonce support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@inline
Patch Set: Rebase. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 14 matching lines...) Expand all
25 25
26 #ifndef ScriptResource_h 26 #ifndef ScriptResource_h
27 #define ScriptResource_h 27 #define ScriptResource_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/fetch/IntegrityMetadata.h" 30 #include "core/fetch/IntegrityMetadata.h"
31 #include "core/fetch/ResourceClient.h" 31 #include "core/fetch/ResourceClient.h"
32 #include "core/fetch/TextResource.h" 32 #include "core/fetch/TextResource.h"
33 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
34 #include "platform/text/CompressibleString.h" 34 #include "platform/text/CompressibleString.h"
35 #include "wtf/text/AtomicString.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 enum class ScriptIntegrityDisposition { 39 enum class ScriptIntegrityDisposition {
39 NotChecked = 0, 40 NotChecked = 0,
40 Failed, 41 Failed,
41 Passed 42 Passed
42 }; 43 };
43 44
44 class FetchRequest; 45 class FetchRequest;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 bool mimeTypeAllowedByNosniff() const; 81 bool mimeTypeAllowedByNosniff() const;
81 82
82 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit yMetadata = metadata; } 83 void setIntegrityMetadata(const IntegrityMetadataSet& metadata) { m_integrit yMetadata = metadata; }
83 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe tadata; } 84 const IntegrityMetadataSet& integrityMetadata() const { return m_integrityMe tadata; }
84 // The argument must never be |NotChecked|. 85 // The argument must never be |NotChecked|.
85 void setIntegrityDisposition(ScriptIntegrityDisposition); 86 void setIntegrityDisposition(ScriptIntegrityDisposition);
86 ScriptIntegrityDisposition integrityDisposition() { return m_integrityDispos ition; } 87 ScriptIntegrityDisposition integrityDisposition() { return m_integrityDispos ition; }
87 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override; 88 bool mustRefetchDueToIntegrityMetadata(const FetchRequest&) const override;
88 89
90 AtomicString contentSecurityPolicyNonce() const { return m_contentSecurityPo licyNonce; }
jww 2016/06/02 23:45:28 Why are these specific to ScriptResource and not R
Mike West 2016/06/04 06:30:56 Thanks for catching this! It's dead code leftover
91 void setContentSecurityPolicyNonce(const AtomicString& nonce) { m_contentSec urityPolicyNonce = nonce; }
92
89 private: 93 private:
90 class ScriptResourceFactory : public ResourceFactory { 94 class ScriptResourceFactory : public ResourceFactory {
91 public: 95 public:
92 ScriptResourceFactory() 96 ScriptResourceFactory()
93 : ResourceFactory(Resource::Script) { } 97 : ResourceFactory(Resource::Script) { }
94 98
95 Resource* create(const ResourceRequest& request, const ResourceLoaderOpt ions& options, const String& charset) const override 99 Resource* create(const ResourceRequest& request, const ResourceLoaderOpt ions& options, const String& charset) const override
96 { 100 {
97 return new ScriptResource(request, options, charset); 101 return new ScriptResource(request, options, charset);
98 } 102 }
99 }; 103 };
100 104
101 ScriptResource(const ResourceRequest&, const ResourceLoaderOptions&, const S tring& charset); 105 ScriptResource(const ResourceRequest&, const ResourceLoaderOptions&, const S tring& charset);
102 106
103 ScriptIntegrityDisposition m_integrityDisposition; 107 ScriptIntegrityDisposition m_integrityDisposition;
104 IntegrityMetadataSet m_integrityMetadata; 108 IntegrityMetadataSet m_integrityMetadata;
109 AtomicString m_contentSecurityPolicyNonce;
105 110
106 CompressibleString m_script; 111 CompressibleString m_script;
107 }; 112 };
108 113
109 DEFINE_RESOURCE_TYPE_CASTS(Script); 114 DEFINE_RESOURCE_TYPE_CASTS(Script);
110 115
111 } // namespace blink 116 } // namespace blink
112 117
113 #endif 118 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698