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

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: Rebase. 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 restore_type_ = entry->restore_type(); 175 restore_type_ = entry->restore_type();
176 is_view_source_ = entry->IsViewSourceMode(); 176 is_view_source_ = entry->IsViewSourceMode();
177 bindings_ = entry->bindings(); 177 bindings_ = entry->bindings();
178 } else { 178 } else {
179 // This is needed to have about:blank and data URLs commit in the same 179 // This is needed to have about:blank and data URLs commit in the same
180 // SiteInstance as the initiating renderer. 180 // SiteInstance as the initiating renderer.
181 source_site_instance_ = 181 source_site_instance_ =
182 frame_tree_node->current_frame_host()->GetSiteInstance(); 182 frame_tree_node->current_frame_host()->GetSiteInstance();
183 } 183 }
184 184
185 // TODO(mkwst): This is incorrect. It ought to use the definition from
186 // 'Document::firstPartyForCookies()' in Blink, which walks the ancestor tree
187 // and verifies that all origins are PSL-matches (and special-cases extension
188 // URLs).
185 const GURL& first_party_for_cookies = 189 const GURL& first_party_for_cookies =
186 frame_tree_node->IsMainFrame() 190 frame_tree_node->IsMainFrame()
187 ? common_params.url 191 ? common_params.url
188 : frame_tree_node->frame_tree()->root()->current_url(); 192 : frame_tree_node->frame_tree()->root()->current_url();
189 bool parent_is_main_frame = !frame_tree_node->parent() ? 193 bool parent_is_main_frame = !frame_tree_node->parent() ?
190 false : frame_tree_node->parent()->IsMainFrame(); 194 false : frame_tree_node->parent()->IsMainFrame();
191 info_.reset(new NavigationRequestInfo( 195 info_.reset(new NavigationRequestInfo(
192 common_params, begin_params, first_party_for_cookies, 196 common_params, begin_params, first_party_for_cookies,
193 frame_tree_node->IsMainFrame(), parent_is_main_frame, 197 frame_tree_node->frame_origin(), frame_tree_node->IsMainFrame(),
194 frame_tree_node->frame_tree_node_id(), body)); 198 parent_is_main_frame, frame_tree_node->frame_tree_node_id(), body));
195 } 199 }
196 200
197 NavigationRequest::~NavigationRequest() { 201 NavigationRequest::~NavigationRequest() {
198 } 202 }
199 203
200 void NavigationRequest::BeginNavigation() { 204 void NavigationRequest::BeginNavigation() {
201 DCHECK(!loader_); 205 DCHECK(!loader_);
202 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE); 206 DCHECK(state_ == NOT_STARTED || state_ == WAITING_FOR_RENDERER_RESPONSE);
203 state_ = STARTED; 207 state_ = STARTED;
204 208
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 browser_context, navigating_frame_host->GetSiteInstance()); 355 browser_context, navigating_frame_host->GetSiteInstance());
352 DCHECK(partition); 356 DCHECK(partition);
353 357
354 ServiceWorkerContextWrapper* service_worker_context = 358 ServiceWorkerContextWrapper* service_worker_context =
355 static_cast<ServiceWorkerContextWrapper*>( 359 static_cast<ServiceWorkerContextWrapper*>(
356 partition->GetServiceWorkerContext()); 360 partition->GetServiceWorkerContext());
357 navigation_handle_->InitServiceWorkerHandle(service_worker_context); 361 navigation_handle_->InitServiceWorkerHandle(service_worker_context);
358 } 362 }
359 363
360 } // namespace content 364 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698