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

Side by Side Diff: Source/core/html/parser/PreloadRequest.h

Issue 1235563004: Apply meta tag referrer policy for preloaded requests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fix Created 5 years, 5 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef PreloadRequest_h 5 #ifndef PreloadRequest_h
6 #define PreloadRequest_h 6 #define PreloadRequest_h
7 7
8 #include "core/fetch/ClientHintsPreferences.h" 8 #include "core/fetch/ClientHintsPreferences.h"
9 #include "core/fetch/FetchRequest.h" 9 #include "core/fetch/FetchRequest.h"
10 #include "core/fetch/Resource.h" 10 #include "core/fetch/Resource.h"
11 #include "platform/weborigin/SecurityPolicy.h"
11 #include "wtf/text/TextPosition.h" 12 #include "wtf/text/TextPosition.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class Document; 16 class Document;
16 17
17 class PreloadRequest { 18 class PreloadRequest {
18 public: 19 public:
19 enum RequestType { RequestTypePreload, RequestTypePreconnect }; 20 enum RequestType { RequestTypePreload, RequestTypePreconnect };
20 21
21 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const ClientHintsPreferences& clientHintsPrefere nces = ClientHintsPreferences(), RequestType requestType = RequestTypePreload) 22 static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const ReferrerPolicy referrerPolicy, const FetchRe quest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth(), const Clien tHintsPreferences& clientHintsPreferences = ClientHintsPreferences(), RequestTyp e requestType = RequestTypePreload)
22 { 23 {
23 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestT ype)); 24 return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, res ourceURL, baseURL, resourceType, resourceWidth, clientHintsPreferences, requestT ype, referrerPolicy));
24 } 25 }
25 26
26 bool isSafeToSendToAnotherThread() const; 27 bool isSafeToSendToAnotherThread() const;
27 28
28 FetchRequest resourceRequest(Document*); 29 FetchRequest resourceRequest(Document*);
29 30
30 const String& charset() const { return m_charset; } 31 const String& charset() const { return m_charset; }
31 double discoveryTime() const { return m_discoveryTime; } 32 double discoveryTime() const { return m_discoveryTime; }
32 void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; } 33 void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; }
33 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); } 34 void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); }
(...skipping 14 matching lines...) Expand all
48 const ClientHintsPreferences& preferences() const { return m_clientHintsPref erences; } 49 const ClientHintsPreferences& preferences() const { return m_clientHintsPref erences; }
49 50
50 private: 51 private:
51 PreloadRequest(const String& initiatorName, 52 PreloadRequest(const String& initiatorName,
52 const TextPosition& initiatorPosition, 53 const TextPosition& initiatorPosition,
53 const String& resourceURL, 54 const String& resourceURL,
54 const KURL& baseURL, 55 const KURL& baseURL,
55 Resource::Type resourceType, 56 Resource::Type resourceType,
56 const FetchRequest::ResourceWidth& resourceWidth, 57 const FetchRequest::ResourceWidth& resourceWidth,
57 const ClientHintsPreferences& clientHintsPreferences, 58 const ClientHintsPreferences& clientHintsPreferences,
58 RequestType requestType) 59 RequestType requestType,
60 const ReferrerPolicy referrerPolicy)
59 : m_initiatorName(initiatorName) 61 : m_initiatorName(initiatorName)
60 , m_initiatorPosition(initiatorPosition) 62 , m_initiatorPosition(initiatorPosition)
61 , m_resourceURL(resourceURL.isolatedCopy()) 63 , m_resourceURL(resourceURL.isolatedCopy())
62 , m_baseURL(baseURL.copy()) 64 , m_baseURL(baseURL.copy())
63 , m_resourceType(resourceType) 65 , m_resourceType(resourceType)
64 , m_isCORSEnabled(false) 66 , m_isCORSEnabled(false)
65 , m_allowCredentials(DoNotAllowStoredCredentials) 67 , m_allowCredentials(DoNotAllowStoredCredentials)
66 , m_discoveryTime(monotonicallyIncreasingTime()) 68 , m_discoveryTime(monotonicallyIncreasingTime())
67 , m_defer(FetchRequest::NoDefer) 69 , m_defer(FetchRequest::NoDefer)
68 , m_resourceWidth(resourceWidth) 70 , m_resourceWidth(resourceWidth)
69 , m_clientHintsPreferences(clientHintsPreferences) 71 , m_clientHintsPreferences(clientHintsPreferences)
70 , m_requestType(requestType) 72 , m_requestType(requestType)
73 , m_referrerPolicy(referrerPolicy)
71 { 74 {
72 } 75 }
73 76
74 KURL completeURL(Document*); 77 KURL completeURL(Document*);
75 78
76 String m_initiatorName; 79 String m_initiatorName;
77 TextPosition m_initiatorPosition; 80 TextPosition m_initiatorPosition;
78 String m_resourceURL; 81 String m_resourceURL;
79 KURL m_baseURL; 82 KURL m_baseURL;
80 String m_charset; 83 String m_charset;
81 Resource::Type m_resourceType; 84 Resource::Type m_resourceType;
82 bool m_isCORSEnabled; 85 bool m_isCORSEnabled;
83 StoredCredentials m_allowCredentials; 86 StoredCredentials m_allowCredentials;
84 double m_discoveryTime; 87 double m_discoveryTime;
85 FetchRequest::DeferOption m_defer; 88 FetchRequest::DeferOption m_defer;
86 FetchRequest::ResourceWidth m_resourceWidth; 89 FetchRequest::ResourceWidth m_resourceWidth;
87 ClientHintsPreferences m_clientHintsPreferences; 90 ClientHintsPreferences m_clientHintsPreferences;
88 RequestType m_requestType; 91 RequestType m_requestType;
92 ReferrerPolicy m_referrerPolicy;
89 }; 93 };
90 94
91 typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream; 95 typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream;
92 96
93 } 97 }
94 98
95 #endif 99 #endif
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | Source/core/html/parser/PreloadRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698