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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1411813003: Teach URLRequest about initiator checks for First-Party-Only cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback. Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 restore_type_ = entry->restore_type(); 174 restore_type_ = entry->restore_type();
175 is_view_source_ = entry->IsViewSourceMode(); 175 is_view_source_ = entry->IsViewSourceMode();
176 bindings_ = entry->bindings(); 176 bindings_ = entry->bindings();
177 } else { 177 } else {
178 // This is needed to have about:blank and data URLs commit in the same 178 // This is needed to have about:blank and data URLs commit in the same
179 // SiteInstance as the initiating renderer. 179 // SiteInstance as the initiating renderer.
180 source_site_instance_ = 180 source_site_instance_ =
181 frame_tree_node->current_frame_host()->GetSiteInstance(); 181 frame_tree_node->current_frame_host()->GetSiteInstance();
182 } 182 }
183 183
184 // TODO(mkwst): This is incorrect. It ought to use the definition from
185 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree
186 // and verifies that all origins are PSL-matches (and special-cases extension
187 // URLs).
184 const GURL& first_party_for_cookies = 188 const GURL& first_party_for_cookies =
185 frame_tree_node->IsMainFrame() 189 frame_tree_node->IsMainFrame()
186 ? common_params.url 190 ? common_params.url
187 : frame_tree_node->frame_tree()->root()->current_url(); 191 : frame_tree_node->frame_tree()->root()->current_url();
188 bool parent_is_main_frame = !frame_tree_node->parent() ? 192 bool parent_is_main_frame = !frame_tree_node->parent() ?
189 false : frame_tree_node->parent()->IsMainFrame(); 193 false : frame_tree_node->parent()->IsMainFrame();
190 info_.reset(new NavigationRequestInfo( 194 info_.reset(new NavigationRequestInfo(
191 common_params, begin_params, first_party_for_cookies, 195 common_params, begin_params, first_party_for_cookies,
192 frame_tree_node->IsMainFrame(), parent_is_main_frame, 196 frame_tree_node->frame_origin(), frame_tree_node->IsMainFrame(),
193 frame_tree_node->frame_tree_node_id(), body)); 197 parent_is_main_frame, frame_tree_node->frame_tree_node_id(), body));
194 } 198 }
195 199
196 NavigationRequest::~NavigationRequest() { 200 NavigationRequest::~NavigationRequest() {
197 } 201 }
198 202
199 void NavigationRequest::BeginNavigation() { 203 void NavigationRequest::BeginNavigation() {
200 DCHECK(!loader_); 204 DCHECK(!loader_);
201 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE); 205 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE);
202 state_ = STARTED; 206 state_ = STARTED;
203 207
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 browser_context, navigating_frame_host->GetSiteInstance()); 354 browser_context, navigating_frame_host->GetSiteInstance());
351 DCHECK(partition); 355 DCHECK(partition);
352 356
353 ServiceWorkerContextWrapper* service_worker_context = 357 ServiceWorkerContextWrapper* service_worker_context =
354 static_cast<ServiceWorkerContextWrapper*>( 358 static_cast<ServiceWorkerContextWrapper*>(
355 partition->GetServiceWorkerContext()); 359 partition->GetServiceWorkerContext());
356 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 360 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
357 } 361 }
358 362
359 } // namespace content 363 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698