OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/loader/stream_resource_handler.h" | 5 #include "content/browser/loader/stream_resource_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/loader/resource_controller.h" | 9 #include "content/browser/loader/resource_controller.h" |
10 #include "net/url_request/url_request_status.h" | 10 #include "net/url_request/url_request_status.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 StreamResourceHandler::StreamResourceHandler(net::URLRequest* request, | 14 StreamResourceHandler::StreamResourceHandler(net::URLRequest* request, |
15 StreamRegistry* registry, | 15 StreamRegistry* registry, |
16 const GURL& origin) | 16 const GURL& origin, |
| 17 bool immediate_mode) |
17 : ResourceHandler(request) { | 18 : ResourceHandler(request) { |
18 writer_.InitializeStream(registry, origin, | 19 writer_.InitializeStream(registry, origin, |
19 base::Bind(&StreamResourceHandler::OutOfBandCancel, | 20 base::Bind(&StreamResourceHandler::OutOfBandCancel, |
20 base::Unretained(this), net::ERR_ABORTED, | 21 base::Unretained(this), net::ERR_ABORTED, |
21 true /* tell_renderer */)); | 22 true /* tell_renderer */)); |
| 23 writer_.set_immediate_mode(immediate_mode); |
22 } | 24 } |
23 | 25 |
24 StreamResourceHandler::~StreamResourceHandler() { | 26 StreamResourceHandler::~StreamResourceHandler() { |
25 } | 27 } |
26 | 28 |
27 void StreamResourceHandler::OnRequestRedirected( | 29 void StreamResourceHandler::OnRequestRedirected( |
28 const net::RedirectInfo& redirect_info, | 30 const net::RedirectInfo& redirect_info, |
29 ResourceResponse* resp, | 31 ResourceResponse* resp, |
30 std::unique_ptr<ResourceController> controller) { | 32 std::unique_ptr<ResourceController> controller) { |
31 controller->Resume(); | 33 controller->Resume(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 std::unique_ptr<ResourceController> controller) { | 66 std::unique_ptr<ResourceController> controller) { |
65 writer_.Finalize(status.error()); | 67 writer_.Finalize(status.error()); |
66 controller->Resume(); | 68 controller->Resume(); |
67 } | 69 } |
68 | 70 |
69 void StreamResourceHandler::OnDataDownloaded(int bytes_downloaded) { | 71 void StreamResourceHandler::OnDataDownloaded(int bytes_downloaded) { |
70 NOTREACHED(); | 72 NOTREACHED(); |
71 } | 73 } |
72 | 74 |
73 } // namespace content | 75 } // namespace content |
OLD | NEW |