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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 218973002: Extract Peer interface out of ResourceLoaderBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASED Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/child/resource_dispatcher_unittest.cc ('k') | content/content_child.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "content/child/web_url_loader_impl.h" 7 #include "content/child/web_url_loader_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "content/child/child_thread.h" 15 #include "content/child/child_thread.h"
16 #include "content/child/ftp_directory_listing_response_delegate.h" 16 #include "content/child/ftp_directory_listing_response_delegate.h"
17 #include "content/child/request_extra_data.h" 17 #include "content/child/request_extra_data.h"
18 #include "content/child/request_info.h" 18 #include "content/child/request_info.h"
19 #include "content/child/sync_load_response.h" 19 #include "content/child/sync_load_response.h"
20 #include "content/common/resource_request_body.h" 20 #include "content/common/resource_request_body.h"
21 #include "content/public/child/request_peer.h"
21 #include "net/base/data_url.h" 22 #include "net/base/data_url.h"
22 #include "net/base/load_flags.h" 23 #include "net/base/load_flags.h"
23 #include "net/base/mime_util.h" 24 #include "net/base/mime_util.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
26 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
27 #include "net/http/http_util.h" 28 #include "net/http/http_util.h"
28 #include "net/url_request/url_request.h" 29 #include "net/url_request/url_request.h"
29 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" 30 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
30 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h" 31 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 215 }
215 216
216 } // namespace 217 } // namespace
217 218
218 // WebURLLoaderImpl::Context -------------------------------------------------- 219 // WebURLLoaderImpl::Context --------------------------------------------------
219 220
220 // This inner class exists since the WebURLLoader may be deleted while inside a 221 // This inner class exists since the WebURLLoader may be deleted while inside a
221 // call to WebURLLoaderClient. The bridge requires its Peer to stay alive 222 // call to WebURLLoaderClient. The bridge requires its Peer to stay alive
222 // until it receives OnCompletedRequest. 223 // until it receives OnCompletedRequest.
223 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, 224 class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
224 public ResourceLoaderBridge::Peer { 225 public RequestPeer {
225 public: 226 public:
226 explicit Context(WebURLLoaderImpl* loader); 227 explicit Context(WebURLLoaderImpl* loader);
227 228
228 WebURLLoaderClient* client() const { return client_; } 229 WebURLLoaderClient* client() const { return client_; }
229 void set_client(WebURLLoaderClient* client) { client_ = client; } 230 void set_client(WebURLLoaderClient* client) { client_ = client; }
230 231
231 void Cancel(); 232 void Cancel();
232 void SetDefersLoading(bool value); 233 void SetDefersLoading(bool value);
233 void DidChangePriority(WebURLRequest::Priority new_priority); 234 void DidChangePriority(WebURLRequest::Priority new_priority);
234 void Start(const WebURLRequest& request, 235 void Start(const WebURLRequest& request,
235 SyncLoadResponse* sync_load_response); 236 SyncLoadResponse* sync_load_response);
236 237
237 // ResourceLoaderBridge::Peer methods: 238 // RequestPeer methods:
238 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; 239 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE;
239 virtual bool OnReceivedRedirect( 240 virtual bool OnReceivedRedirect(
240 const GURL& new_url, 241 const GURL& new_url,
241 const ResourceResponseInfo& info, 242 const ResourceResponseInfo& info,
242 bool* has_new_first_party_for_cookies, 243 bool* has_new_first_party_for_cookies,
243 GURL* new_first_party_for_cookies) OVERRIDE; 244 GURL* new_first_party_for_cookies) OVERRIDE;
244 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE; 245 virtual void OnReceivedResponse(const ResourceResponseInfo& info) OVERRIDE;
245 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE; 246 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE;
246 virtual void OnReceivedData(const char* data, 247 virtual void OnReceivedData(const char* data,
247 int data_length, 248 int data_length,
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 865
865 void WebURLLoaderImpl::setDefersLoading(bool value) { 866 void WebURLLoaderImpl::setDefersLoading(bool value) {
866 context_->SetDefersLoading(value); 867 context_->SetDefersLoading(value);
867 } 868 }
868 869
869 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 870 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
870 context_->DidChangePriority(new_priority); 871 context_->DidChangePriority(new_priority);
871 } 872 }
872 873
873 } // namespace content 874 } // namespace content
OLDNEW
« no previous file with comments | « content/child/resource_dispatcher_unittest.cc ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698