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

Side by Side Diff: third_party/WebKit/Source/core/loader/HistoryItem.cpp

Issue 2130623003: Teach HistoryItem about a request's initiator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: String, not RefPtr, because lifetimes... Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/HistoryItem.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/loader/HistoryItem.h" 26 #include "core/loader/HistoryItem.h"
27 27
28 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
29 #include "core/html/forms/FormController.h" 29 #include "core/html/forms/FormController.h"
30 #include "platform/network/ResourceRequest.h" 30 #include "platform/network/ResourceRequest.h"
31 #include "platform/weborigin/SecurityOrigin.h"
31 #include "platform/weborigin/SecurityPolicy.h" 32 #include "platform/weborigin/SecurityPolicy.h"
32 #include "wtf/Assertions.h" 33 #include "wtf/Assertions.h"
33 #include "wtf/CurrentTime.h" 34 #include "wtf/CurrentTime.h"
34 #include "wtf/text/CString.h" 35 #include "wtf/text/CString.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 static long long generateSequenceNumber() 39 static long long generateSequenceNumber()
39 { 40 {
40 // Initialize to the current time to reduce the likelihood of generating 41 // Initialize to the current time to reduce the likelihood of generating
(...skipping 27 matching lines...) Expand all
68 const Referrer& HistoryItem::referrer() const 69 const Referrer& HistoryItem::referrer() const
69 { 70 {
70 return m_referrer; 71 return m_referrer;
71 } 72 }
72 73
73 const String& HistoryItem::target() const 74 const String& HistoryItem::target() const
74 { 75 {
75 return m_target; 76 return m_target;
76 } 77 }
77 78
79 PassRefPtr<SecurityOrigin> HistoryItem::requestorOrigin() const
80 {
81 return SecurityOrigin::createFromString(m_requestorOrigin);
82 }
83
78 void HistoryItem::setURLString(const String& urlString) 84 void HistoryItem::setURLString(const String& urlString)
79 { 85 {
80 if (m_urlString != urlString) 86 if (m_urlString != urlString)
81 m_urlString = urlString; 87 m_urlString = urlString;
82 } 88 }
83 89
84 void HistoryItem::setURL(const KURL& url) 90 void HistoryItem::setURL(const KURL& url)
85 { 91 {
86 setURLString(url.getString()); 92 setURLString(url.getString());
87 } 93 }
88 94
89 void HistoryItem::setReferrer(const Referrer& referrer) 95 void HistoryItem::setReferrer(const Referrer& referrer)
90 { 96 {
91 // This should be a RELEASE_ASSERT. 97 // This should be a RELEASE_ASSERT.
92 m_referrer = SecurityPolicy::generateReferrer(referrer.referrerPolicy, url() , referrer.referrer); 98 m_referrer = SecurityPolicy::generateReferrer(referrer.referrerPolicy, url() , referrer.referrer);
93 } 99 }
94 100
101 void HistoryItem::setRequestorOrigin(PassRefPtr<SecurityOrigin> origin)
102 {
103 m_requestorOrigin = origin->toString();
104 }
105
95 void HistoryItem::setTarget(const String& target) 106 void HistoryItem::setTarget(const String& target)
96 { 107 {
97 m_target = target; 108 m_target = target;
98 } 109 }
99 110
100 const FloatPoint& HistoryItem::visualViewportScrollPoint() const 111 const FloatPoint& HistoryItem::visualViewportScrollPoint() const
101 { 112 {
102 return m_visualViewportScrollPoint; 113 return m_visualViewportScrollPoint;
103 } 114 }
104 115
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // FIXME: We should find a better way to check if this is the current docume nt. 210 // FIXME: We should find a better way to check if this is the current docume nt.
200 return equalIgnoringFragmentIdentifier(url(), doc->url()); 211 return equalIgnoringFragmentIdentifier(url(), doc->url());
201 } 212 }
202 213
203 DEFINE_TRACE(HistoryItem) 214 DEFINE_TRACE(HistoryItem)
204 { 215 {
205 visitor->trace(m_documentState); 216 visitor->trace(m_documentState);
206 } 217 }
207 218
208 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/HistoryItem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698