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 #include "content/browser/renderer_host/redirect_to_file_resource_handler.h" | 5 #include "content/browser/renderer_host/redirect_to_file_resource_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 base::ThreadRestrictions::ScopedAllowIO allow_io; | 53 base::ThreadRestrictions::ScopedAllowIO allow_io; |
54 file_stream_->CloseSync(); | 54 file_stream_->CloseSync(); |
55 file_stream_.reset(); | 55 file_stream_.reset(); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 bool RedirectToFileResourceHandler::OnResponseStarted( | 59 bool RedirectToFileResourceHandler::OnResponseStarted( |
60 int request_id, | 60 int request_id, |
61 ResourceResponse* response, | 61 ResourceResponse* response, |
62 bool* defer) { | 62 bool* defer) { |
63 if (response->status.is_success()) { | 63 if (response->head.status.is_success()) { |
64 DCHECK(deletable_file_ && !deletable_file_->path().empty()); | 64 DCHECK(deletable_file_ && !deletable_file_->path().empty()); |
65 response->download_file_path = deletable_file_->path(); | 65 response->head.download_file_path = deletable_file_->path(); |
66 } | 66 } |
67 return next_handler_->OnResponseStarted(request_id, response, defer); | 67 return next_handler_->OnResponseStarted(request_id, response, defer); |
68 } | 68 } |
69 | 69 |
70 bool RedirectToFileResourceHandler::OnWillStart(int request_id, | 70 bool RedirectToFileResourceHandler::OnWillStart(int request_id, |
71 const GURL& url, | 71 const GURL& url, |
72 bool* defer) { | 72 bool* defer) { |
73 request_id_ = request_id; | 73 request_id_ = request_id; |
74 if (!deletable_file_) { | 74 if (!deletable_file_) { |
75 // Defer starting the request until we have created the temporary file. | 75 // Defer starting the request until we have created the temporary file. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 void RedirectToFileResourceHandler::ResumeIfDeferred() { | 239 void RedirectToFileResourceHandler::ResumeIfDeferred() { |
240 if (did_defer_) { | 240 if (did_defer_) { |
241 did_defer_ = false; | 241 did_defer_ = false; |
242 controller()->Resume(); | 242 controller()->Resume(); |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 } // namespace content | 246 } // namespace content |
OLD | NEW |