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

Side by Side Diff: third_party/WebKit/Source/web/WebDataSourceImpl.cpp

Issue 2416523002: Expose the initiating origin/URL of a navigation in the Blink public API (Closed)
Patch Set: rebase Created 4 years 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "public/platform/WebVector.h" 37 #include "public/platform/WebVector.h"
38 #include "wtf/PtrUtil.h" 38 #include "wtf/PtrUtil.h"
39 #include <memory> 39 #include <memory>
40 40
41 namespace blink { 41 namespace blink {
42 42
43 WebDataSourceImpl* WebDataSourceImpl::create( 43 WebDataSourceImpl* WebDataSourceImpl::create(
44 LocalFrame* frame, 44 LocalFrame* frame,
45 const ResourceRequest& request, 45 const ResourceRequest& request,
46 const SubstituteData& data, 46 const SubstituteData& data,
47 ClientRedirectPolicy clientRedirectPolicy) { 47 ClientRedirectPolicy clientRedirectPolicy,
48 return new WebDataSourceImpl(frame, request, data, clientRedirectPolicy); 48 Document* requestorDocument) {
49 return new WebDataSourceImpl(frame, request, data, clientRedirectPolicy,
50 requestorDocument);
51 }
52
53 WebURL WebDataSourceImpl::requestorURL() const {
54 return requestorDocument() ? WebURL(requestorDocument()->url()) : WebURL();
49 } 55 }
50 56
51 const WebURLRequest& WebDataSourceImpl::originalRequest() const { 57 const WebURLRequest& WebDataSourceImpl::originalRequest() const {
52 return m_originalRequestWrapper; 58 return m_originalRequestWrapper;
53 } 59 }
54 60
55 const WebURLRequest& WebDataSourceImpl::request() const { 61 const WebURLRequest& WebDataSourceImpl::request() const {
56 return m_requestWrapper; 62 return m_requestWrapper;
57 } 63 }
58 64
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return WebNavigationTypeFormResubmitted; 138 return WebNavigationTypeFormResubmitted;
133 case NavigationTypeOther: 139 case NavigationTypeOther:
134 default: 140 default:
135 return WebNavigationTypeOther; 141 return WebNavigationTypeOther;
136 } 142 }
137 } 143 }
138 144
139 WebDataSourceImpl::WebDataSourceImpl(LocalFrame* frame, 145 WebDataSourceImpl::WebDataSourceImpl(LocalFrame* frame,
140 const ResourceRequest& request, 146 const ResourceRequest& request,
141 const SubstituteData& data, 147 const SubstituteData& data,
142 ClientRedirectPolicy clientRedirectPolicy) 148 ClientRedirectPolicy clientRedirectPolicy,
143 : DocumentLoader(frame, request, data, clientRedirectPolicy), 149 Document* requestorDocument)
150 : DocumentLoader(frame,
151 request,
152 data,
153 clientRedirectPolicy,
154 requestorDocument),
144 m_originalRequestWrapper(DocumentLoader::originalRequest()), 155 m_originalRequestWrapper(DocumentLoader::originalRequest()),
145 m_requestWrapper(DocumentLoader::request()), 156 m_requestWrapper(DocumentLoader::request()),
146 m_responseWrapper(DocumentLoader::response()) {} 157 m_responseWrapper(DocumentLoader::response()) {}
147 158
148 WebDataSourceImpl::~WebDataSourceImpl() { 159 WebDataSourceImpl::~WebDataSourceImpl() {
149 // Verify that detachFromFrame() has been called. 160 // Verify that detachFromFrame() has been called.
150 DCHECK(!m_extraData); 161 DCHECK(!m_extraData);
151 } 162 }
152 163
153 void WebDataSourceImpl::detachFromFrame() { 164 void WebDataSourceImpl::detachFromFrame() {
154 DocumentLoader::detachFromFrame(); 165 DocumentLoader::detachFromFrame();
155 m_extraData.reset(); 166 m_extraData.reset();
156 } 167 }
157 168
158 void WebDataSourceImpl::setSubresourceFilter( 169 void WebDataSourceImpl::setSubresourceFilter(
159 WebDocumentSubresourceFilter* subresourceFilter) { 170 WebDocumentSubresourceFilter* subresourceFilter) {
160 DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter)); 171 DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter));
161 } 172 }
162 173
163 DEFINE_TRACE(WebDataSourceImpl) { 174 DEFINE_TRACE(WebDataSourceImpl) {
164 DocumentLoader::trace(visitor); 175 DocumentLoader::trace(visitor);
165 } 176 }
166 177
167 } // namespace blink 178 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDataSourceImpl.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698