OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child/weburlloader_impl.h" | 7 #include "webkit/child/weburlloader_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" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, | 216 class WebURLLoaderImpl::Context : public base::RefCounted<Context>, |
217 public ResourceLoaderBridge::Peer { | 217 public ResourceLoaderBridge::Peer { |
218 public: | 218 public: |
219 explicit Context(WebURLLoaderImpl* loader); | 219 explicit Context(WebURLLoaderImpl* loader); |
220 | 220 |
221 WebURLLoaderClient* client() const { return client_; } | 221 WebURLLoaderClient* client() const { return client_; } |
222 void set_client(WebURLLoaderClient* client) { client_ = client; } | 222 void set_client(WebURLLoaderClient* client) { client_ = client; } |
223 | 223 |
224 void Cancel(); | 224 void Cancel(); |
225 void SetDefersLoading(bool value); | 225 void SetDefersLoading(bool value); |
226 void DidChangePriority(WebURLRequest::Priority new_priority, int value); | 226 void DidChangePriority(WebURLRequest::Priority new_priority, |
| 227 int intra_priority_value); |
227 void Start( | 228 void Start( |
228 const WebURLRequest& request, | 229 const WebURLRequest& request, |
229 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 230 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
230 WebKitPlatformSupportImpl* platform); | 231 WebKitPlatformSupportImpl* platform); |
231 | 232 |
232 // ResourceLoaderBridge::Peer methods: | 233 // ResourceLoaderBridge::Peer methods: |
233 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 234 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
234 virtual bool OnReceivedRedirect( | 235 virtual bool OnReceivedRedirect( |
235 const GURL& new_url, | 236 const GURL& new_url, |
236 const ResourceResponseInfo& info, | 237 const ResourceResponseInfo& info, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 client_ = NULL; | 288 client_ = NULL; |
288 loader_ = NULL; | 289 loader_ = NULL; |
289 } | 290 } |
290 | 291 |
291 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { | 292 void WebURLLoaderImpl::Context::SetDefersLoading(bool value) { |
292 if (bridge_) | 293 if (bridge_) |
293 bridge_->SetDefersLoading(value); | 294 bridge_->SetDefersLoading(value); |
294 } | 295 } |
295 | 296 |
296 void WebURLLoaderImpl::Context::DidChangePriority( | 297 void WebURLLoaderImpl::Context::DidChangePriority( |
297 WebURLRequest::Priority new_priority, int value) { | 298 WebURLRequest::Priority new_priority, int intra_priority_value) { |
298 if (bridge_) | 299 if (bridge_) |
299 bridge_->DidChangePriority( | 300 bridge_->DidChangePriority( |
300 ConvertWebKitPriorityToNetPriority(new_priority), value); | 301 ConvertWebKitPriorityToNetPriority(new_priority), intra_priority_value); |
301 } | 302 } |
302 | 303 |
303 void WebURLLoaderImpl::Context::Start( | 304 void WebURLLoaderImpl::Context::Start( |
304 const WebURLRequest& request, | 305 const WebURLRequest& request, |
305 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, | 306 ResourceLoaderBridge::SyncLoadResponse* sync_load_response, |
306 WebKitPlatformSupportImpl* platform) { | 307 WebKitPlatformSupportImpl* platform) { |
307 DCHECK(!bridge_.get()); | 308 DCHECK(!bridge_.get()); |
308 | 309 |
309 request_ = request; // Save the request. | 310 request_ = request; // Save the request. |
310 | 311 |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 } | 846 } |
846 | 847 |
847 void WebURLLoaderImpl::cancel() { | 848 void WebURLLoaderImpl::cancel() { |
848 context_->Cancel(); | 849 context_->Cancel(); |
849 } | 850 } |
850 | 851 |
851 void WebURLLoaderImpl::setDefersLoading(bool value) { | 852 void WebURLLoaderImpl::setDefersLoading(bool value) { |
852 context_->SetDefersLoading(value); | 853 context_->SetDefersLoading(value); |
853 } | 854 } |
854 | 855 |
855 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, i
nt value) { | 856 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority, |
856 context_->DidChangePriority(new_priority, value); | 857 int intra_priority_value) { |
| 858 context_->DidChangePriority(new_priority, intra_priority_value); |
857 } | 859 } |
858 | 860 |
859 } // namespace webkit_glue | 861 } // namespace webkit_glue |
OLD | NEW |