OLD | NEW |
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 #include "mojo/services/network/url_loader_impl.h" | 5 #include "mojo/services/network/url_loader_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 } | 529 } |
530 if (request->body) { | 530 if (request->body) { |
531 ScopedVector<net::UploadElementReader> element_readers; | 531 ScopedVector<net::UploadElementReader> element_readers; |
532 for (size_t i = 0; i < request->body.size(); ++i) { | 532 for (size_t i = 0; i < request->body.size(); ++i) { |
533 element_readers.push_back( | 533 element_readers.push_back( |
534 new UploadDataPipeElementReader(request->body[i].Pass())); | 534 new UploadDataPipeElementReader(request->body[i].Pass())); |
535 } | 535 } |
536 url_request_->set_upload(make_scoped_ptr<net::UploadDataStream>( | 536 url_request_->set_upload(make_scoped_ptr<net::UploadDataStream>( |
537 new net::ElementsUploadDataStream(element_readers.Pass(), 0))); | 537 new net::ElementsUploadDataStream(element_readers.Pass(), 0))); |
538 } | 538 } |
| 539 int load_flags = 0; |
539 if (request->bypass_cache) | 540 if (request->bypass_cache) |
540 url_request_->SetLoadFlags(net::LOAD_BYPASS_CACHE); | 541 load_flags |= net::LOAD_BYPASS_CACHE; |
| 542 if (request->only_from_cache) |
| 543 load_flags |= net::LOAD_ONLY_FROM_CACHE; |
| 544 if (load_flags) |
| 545 url_request_->SetLoadFlags(load_flags); |
541 | 546 |
542 response_body_buffer_size_ = request->response_body_buffer_size; | 547 response_body_buffer_size_ = request->response_body_buffer_size; |
543 auto_follow_redirects_ = request->auto_follow_redirects; | 548 auto_follow_redirects_ = request->auto_follow_redirects; |
544 | 549 |
545 url_request_->Start(); | 550 url_request_->Start(); |
546 } | 551 } |
547 | 552 |
548 void URLLoaderImpl::SendResponse(URLResponsePtr response) { | 553 void URLLoaderImpl::SendResponse(URLResponsePtr response) { |
549 if (interceptor_index_ >= 0 && | 554 if (interceptor_index_ >= 0 && |
550 interceptor_index_ < static_cast<int>(interceptors_.size())) { | 555 interceptor_index_ < static_cast<int>(interceptors_.size())) { |
(...skipping 20 matching lines...) Expand all Loading... |
571 if ((*it)->id() == current_fetcher_id_) { | 576 if ((*it)->id() == current_fetcher_id_) { |
572 last_status_ = fetcher->QueryStatus(); | 577 last_status_ = fetcher->QueryStatus(); |
573 last_status_->is_loading = false; | 578 last_status_->is_loading = false; |
574 } | 579 } |
575 body_fetchers_.erase(it); | 580 body_fetchers_.erase(it); |
576 if (body_fetchers_.empty() and !binding_.is_bound()) | 581 if (body_fetchers_.empty() and !binding_.is_bound()) |
577 delete this; | 582 delete this; |
578 } | 583 } |
579 | 584 |
580 } // namespace mojo | 585 } // namespace mojo |
OLD | NEW |