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

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: Fix typo Created 4 years, 1 month 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 m_requestorDocument->url();
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,
149 Document* requestorDocument)
143 : DocumentLoader(frame, request, data, clientRedirectPolicy), 150 : DocumentLoader(frame, request, data, clientRedirectPolicy),
151 m_requestorDocument(requestorDocument),
144 m_originalRequestWrapper(DocumentLoader::originalRequest()), 152 m_originalRequestWrapper(DocumentLoader::originalRequest()),
145 m_requestWrapper(DocumentLoader::request()), 153 m_requestWrapper(DocumentLoader::request()),
146 m_responseWrapper(DocumentLoader::response()) {} 154 m_responseWrapper(DocumentLoader::response()) {}
147 155
148 WebDataSourceImpl::~WebDataSourceImpl() { 156 WebDataSourceImpl::~WebDataSourceImpl() {
149 // Verify that detachFromFrame() has been called. 157 // Verify that detachFromFrame() has been called.
150 DCHECK(!m_extraData); 158 DCHECK(!m_extraData);
151 } 159 }
152 160
153 void WebDataSourceImpl::detachFromFrame() { 161 void WebDataSourceImpl::detachFromFrame() {
154 DocumentLoader::detachFromFrame(); 162 DocumentLoader::detachFromFrame();
155 m_extraData.reset(); 163 m_extraData.reset();
156 } 164 }
157 165
158 void WebDataSourceImpl::setSubresourceFilter( 166 void WebDataSourceImpl::setSubresourceFilter(
159 WebDocumentSubresourceFilter* subresourceFilter) { 167 WebDocumentSubresourceFilter* subresourceFilter) {
160 DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter)); 168 DocumentLoader::setSubresourceFilter(WTF::wrapUnique(subresourceFilter));
161 } 169 }
162 170
163 DEFINE_TRACE(WebDataSourceImpl) { 171 DEFINE_TRACE(WebDataSourceImpl) {
164 DocumentLoader::trace(visitor); 172 DocumentLoader::trace(visitor);
173 visitor->trace(m_requestorDocument);
165 } 174 }
166 175
167 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698