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

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 385024: Propagate the "first party for cookies" from WebKit through the resource... (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-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This file contains an implementation of the ResourceLoaderBridge class. 5 // This file contains an implementation of the ResourceLoaderBridge class.
6 // The class is implemented using URLRequest, meaning it is a "simple" version 6 // The class is implemented using URLRequest, meaning it is a "simple" version
7 // that directly issues requests. The more complicated one used in the 7 // that directly issues requests. The more complicated one used in the
8 // browser uses IPC. 8 // browser uses IPC.
9 // 9 //
10 // Because URLRequest only provides an asynchronous resource loading API, this 10 // Because URLRequest only provides an asynchronous resource loading API, this
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 MessageLoop::current() == io_thread->message_loop()); 146 MessageLoop::current() == io_thread->message_loop());
147 } 147 }
148 148
149 // -------------------------------------------------------------------------- 149 // --------------------------------------------------------------------------
150 // The following methods are called on the owner's thread in response to 150 // The following methods are called on the owner's thread in response to
151 // various URLRequest callbacks. The event hooks, defined below, trigger 151 // various URLRequest callbacks. The event hooks, defined below, trigger
152 // these methods asynchronously. 152 // these methods asynchronously.
153 153
154 void NotifyReceivedRedirect(const GURL& new_url, 154 void NotifyReceivedRedirect(const GURL& new_url,
155 const ResourceLoaderBridge::ResponseInfo& info) { 155 const ResourceLoaderBridge::ResponseInfo& info) {
156 if (peer_ && peer_->OnReceivedRedirect(new_url, info)) { 156 GURL new_first_party_for_cookies;
157 if (peer_ && peer_->OnReceivedRedirect(new_url, info,
158 &new_first_party_for_cookies)) {
157 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( 159 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
158 this, &RequestProxy::AsyncFollowDeferredRedirect)); 160 this, &RequestProxy::AsyncFollowDeferredRedirect,
161 new_first_party_for_cookies));
159 } else { 162 } else {
160 Cancel(); 163 Cancel();
161 } 164 }
162 } 165 }
163 166
164 void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info, 167 void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info,
165 bool content_filtered) { 168 bool content_filtered) {
166 if (peer_) 169 if (peer_)
167 peer_->OnReceivedResponse(info, content_filtered); 170 peer_->OnReceivedResponse(info, content_filtered);
168 } 171 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 234
232 void AsyncCancel() { 235 void AsyncCancel() {
233 // This can be null in cases where the request is already done. 236 // This can be null in cases where the request is already done.
234 if (!request_.get()) 237 if (!request_.get())
235 return; 238 return;
236 239
237 request_->Cancel(); 240 request_->Cancel();
238 Done(); 241 Done();
239 } 242 }
240 243
241 void AsyncFollowDeferredRedirect() { 244 void AsyncFollowDeferredRedirect(const GURL& new_first_party_for_cookies) {
242 // This can be null in cases where the request is already done. 245 // This can be null in cases where the request is already done.
243 if (!request_.get()) 246 if (!request_.get())
244 return; 247 return;
245 248
249 if (!new_first_party_for_cookies.is_empty())
250 request_->set_first_party_for_cookies(new_first_party_for_cookies);
246 request_->FollowDeferredRedirect(); 251 request_->FollowDeferredRedirect();
247 } 252 }
248 253
249 void AsyncReadData() { 254 void AsyncReadData() {
250 // This can be null in cases where the request is already done. 255 // This can be null in cases where the request is already done.
251 if (!request_.get()) 256 if (!request_.get())
252 return; 257 return;
253 258
254 if (request_->status().is_success()) { 259 if (request_->status().is_success()) {
255 int bytes_read; 260 int bytes_read;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 options.message_loop_type = MessageLoop::TYPE_IO; 741 options.message_loop_type = MessageLoop::TYPE_IO;
737 return io_thread->StartWithOptions(options); 742 return io_thread->StartWithOptions(options);
738 } 743 }
739 744
740 // static 745 // static
741 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { 746 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) {
742 CookiePolicy::Type policy_type = accept_all_cookies ? 747 CookiePolicy::Type policy_type = accept_all_cookies ?
743 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES; 748 CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
744 request_context->cookie_policy()->set_type(policy_type); 749 request_context->cookie_policy()->set_type(policy_type);
745 } 750 }
OLDNEW
« webkit/glue/resource_loader_bridge.h ('K') | « webkit/glue/weburlloader_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698