| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" |
| 9 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 12 #include "base/process_util.h" | 13 #include "base/process_util.h" |
| 13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 14 #include "base/time.h" | 15 #include "base/time.h" |
| 15 #include "net/base/data_url.h" | 16 #include "net/base/data_url.h" |
| 16 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
| 17 #include "net/base/mime_util.h" | 18 #include "net/base/mime_util.h" |
| 18 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (sync_load_response) { | 342 if (sync_load_response) { |
| 342 // This is a sync load. Do the work now. | 343 // This is a sync load. Do the work now. |
| 343 sync_load_response->url = url; | 344 sync_load_response->url = url; |
| 344 std::string data; | 345 std::string data; |
| 345 GetInfoFromDataURL(sync_load_response->url, sync_load_response, | 346 GetInfoFromDataURL(sync_load_response->url, sync_load_response, |
| 346 &sync_load_response->data, | 347 &sync_load_response->data, |
| 347 &sync_load_response->status); | 348 &sync_load_response->status); |
| 348 } else { | 349 } else { |
| 349 AddRef(); // Balanced in OnCompletedRequest | 350 AddRef(); // Balanced in OnCompletedRequest |
| 350 MessageLoop::current()->PostTask(FROM_HERE, | 351 MessageLoop::current()->PostTask(FROM_HERE, |
| 351 NewRunnableMethod(this, &Context::HandleDataURL)); | 352 base::Bind(&Context::HandleDataURL, this)); |
| 352 } | 353 } |
| 353 return; | 354 return; |
| 354 } | 355 } |
| 355 | 356 |
| 356 GURL referrer_url( | 357 GURL referrer_url( |
| 357 request.httpHeaderField(WebString::fromUTF8("Referer")).utf8()); | 358 request.httpHeaderField(WebString::fromUTF8("Referer")).utf8()); |
| 358 const std::string& method = request.httpMethod().utf8(); | 359 const std::string& method = request.httpMethod().utf8(); |
| 359 | 360 |
| 360 int load_flags = net::LOAD_NORMAL; | 361 int load_flags = net::LOAD_NORMAL; |
| 361 switch (request.cachePolicy()) { | 362 switch (request.cachePolicy()) { |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 | 736 |
| 736 void WebURLLoaderImpl::setDefersLoading(bool value) { | 737 void WebURLLoaderImpl::setDefersLoading(bool value) { |
| 737 context_->SetDefersLoading(value); | 738 context_->SetDefersLoading(value); |
| 738 } | 739 } |
| 739 | 740 |
| 740 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { | 741 void WebURLLoaderImpl::UpdateRoutingId(int new_routing_id) { |
| 741 context_->UpdateRoutingId(new_routing_id); | 742 context_->UpdateRoutingId(new_routing_id); |
| 742 } | 743 } |
| 743 | 744 |
| 744 } // namespace webkit_glue | 745 } // namespace webkit_glue |
| OLD | NEW |