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

Side by Side Diff: webkit/glue/weburlloader_impl.cc

Issue 405011: Use an explicit boolean has_new_first_party_for_cookies instead... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Upload before checkin Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "webkit/glue/weburlloader_impl.h" 7 #include "webkit/glue/weburlloader_impl.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 void SetDefersLoading(bool value); 204 void SetDefersLoading(bool value);
205 void Start( 205 void Start(
206 const WebURLRequest& request, 206 const WebURLRequest& request,
207 ResourceLoaderBridge::SyncLoadResponse* sync_load_response); 207 ResourceLoaderBridge::SyncLoadResponse* sync_load_response);
208 208
209 // ResourceLoaderBridge::Peer methods: 209 // ResourceLoaderBridge::Peer methods:
210 virtual void OnUploadProgress(uint64 position, uint64 size); 210 virtual void OnUploadProgress(uint64 position, uint64 size);
211 virtual bool OnReceivedRedirect( 211 virtual bool OnReceivedRedirect(
212 const GURL& new_url, 212 const GURL& new_url,
213 const ResourceLoaderBridge::ResponseInfo& info, 213 const ResourceLoaderBridge::ResponseInfo& info,
214 bool* has_new_first_party_for_cookies,
214 GURL* new_first_party_for_cookies); 215 GURL* new_first_party_for_cookies);
215 virtual void OnReceivedResponse( 216 virtual void OnReceivedResponse(
216 const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered); 217 const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered);
217 virtual void OnReceivedData(const char* data, int len); 218 virtual void OnReceivedData(const char* data, int len);
218 virtual void OnCompletedRequest( 219 virtual void OnCompletedRequest(
219 const URLRequestStatus& status, const std::string& security_info); 220 const URLRequestStatus& status, const std::string& security_info);
220 virtual GURL GetURLForDebugging() const; 221 virtual GURL GetURLForDebugging() const;
221 222
222 private: 223 private:
223 friend class base::RefCounted<Context>; 224 friend class base::RefCounted<Context>;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 385 }
385 386
386 void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) { 387 void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) {
387 if (client_) 388 if (client_)
388 client_->didSendData(loader_, position, size); 389 client_->didSendData(loader_, position, size);
389 } 390 }
390 391
391 bool WebURLLoaderImpl::Context::OnReceivedRedirect( 392 bool WebURLLoaderImpl::Context::OnReceivedRedirect(
392 const GURL& new_url, 393 const GURL& new_url,
393 const ResourceLoaderBridge::ResponseInfo& info, 394 const ResourceLoaderBridge::ResponseInfo& info,
395 bool* has_new_first_party_for_cookies,
394 GURL* new_first_party_for_cookies) { 396 GURL* new_first_party_for_cookies) {
395 if (!client_) 397 if (!client_)
396 return false; 398 return false;
397 399
398 WebURLResponse response; 400 WebURLResponse response;
399 response.initialize(); 401 response.initialize();
400 PopulateURLResponse(request_.url(), info, &response); 402 PopulateURLResponse(request_.url(), info, &response);
401 403
402 // TODO(darin): We lack sufficient information to construct the actual 404 // TODO(darin): We lack sufficient information to construct the actual
403 // request that resulted from the redirect. 405 // request that resulted from the redirect.
404 WebURLRequest new_request(new_url); 406 WebURLRequest new_request(new_url);
405 new_request.setFirstPartyForCookies(request_.firstPartyForCookies()); 407 new_request.setFirstPartyForCookies(request_.firstPartyForCookies());
406 if (response.httpStatusCode() == 307) 408 if (response.httpStatusCode() == 307)
407 new_request.setHTTPMethod(request_.httpMethod()); 409 new_request.setHTTPMethod(request_.httpMethod());
408 410
409 client_->willSendRequest(loader_, new_request, response); 411 client_->willSendRequest(loader_, new_request, response);
410 request_ = new_request; 412 request_ = new_request;
413 *has_new_first_party_for_cookies = true;
411 *new_first_party_for_cookies = request_.firstPartyForCookies(); 414 *new_first_party_for_cookies = request_.firstPartyForCookies();
412 415
413 // Only follow the redirect if WebKit left the URL unmodified. 416 // Only follow the redirect if WebKit left the URL unmodified.
414 if (new_url == GURL(new_request.url())) 417 if (new_url == GURL(new_request.url()))
415 return true; 418 return true;
416 419
417 // We assume that WebKit only changes the URL to suppress a redirect, and we 420 // We assume that WebKit only changes the URL to suppress a redirect, and we
418 // assume that it does so by setting it to be invalid. 421 // assume that it does so by setting it to be invalid.
419 DCHECK(!new_request.url().isValid()); 422 DCHECK(!new_request.url().isValid());
420 return false; 423 return false;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 587
585 void WebURLLoaderImpl::cancel() { 588 void WebURLLoaderImpl::cancel() {
586 context_->Cancel(); 589 context_->Cancel();
587 } 590 }
588 591
589 void WebURLLoaderImpl::setDefersLoading(bool value) { 592 void WebURLLoaderImpl::setDefersLoading(bool value) {
590 context_->SetDefersLoading(value); 593 context_->SetDefersLoading(value);
591 } 594 }
592 595
593 } // namespace webkit_glue 596 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/resource_loader_bridge.h ('k') | webkit/tools/test_shell/simple_resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698