| 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/download/save_file_resource_handler.h" | 5 #include "content/browser/download/save_file_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 "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 read_buffer_.swap(buffer); | 83 read_buffer_.swap(buffer); |
| 84 BrowserThread::PostTask( | 84 BrowserThread::PostTask( |
| 85 BrowserThread::FILE, FROM_HERE, | 85 BrowserThread::FILE, FROM_HERE, |
| 86 base::Bind(&SaveFileManager::UpdateSaveProgress, save_manager_, | 86 base::Bind(&SaveFileManager::UpdateSaveProgress, save_manager_, |
| 87 save_item_id_, base::RetainedRef(buffer), bytes_read)); | 87 save_item_id_, base::RetainedRef(buffer), bytes_read)); |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SaveFileResourceHandler::OnResponseCompleted( | 91 void SaveFileResourceHandler::OnResponseCompleted( |
| 92 const net::URLRequestStatus& status, | 92 const net::URLRequestStatus& status, |
| 93 const std::string& security_info, | |
| 94 bool* defer) { | 93 bool* defer) { |
| 95 if (authorization_state_ != AuthorizationState::AUTHORIZED) | 94 if (authorization_state_ != AuthorizationState::AUTHORIZED) |
| 96 DCHECK(!status.is_success()); | 95 DCHECK(!status.is_success()); |
| 97 | 96 |
| 98 BrowserThread::PostTask( | 97 BrowserThread::PostTask( |
| 99 BrowserThread::FILE, FROM_HERE, | 98 BrowserThread::FILE, FROM_HERE, |
| 100 base::Bind(&SaveFileManager::SaveFinished, save_manager_, save_item_id_, | 99 base::Bind(&SaveFileManager::SaveFinished, save_manager_, save_item_id_, |
| 101 save_package_id_, | 100 save_package_id_, |
| 102 status.is_success() && !status.is_io_pending())); | 101 status.is_success() && !status.is_io_pending())); |
| 103 read_buffer_ = NULL; | 102 read_buffer_ = NULL; |
| 104 } | 103 } |
| 105 | 104 |
| 106 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) { | 105 void SaveFileResourceHandler::OnDataDownloaded(int bytes_downloaded) { |
| 107 NOTREACHED(); | 106 NOTREACHED(); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void SaveFileResourceHandler::set_content_length( | 109 void SaveFileResourceHandler::set_content_length( |
| 111 const std::string& content_length) { | 110 const std::string& content_length) { |
| 112 base::StringToInt64(content_length, &content_length_); | 111 base::StringToInt64(content_length, &content_length_); |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace content | 114 } // namespace content |
| OLD | NEW |