| 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_package.h" | 5 #include "content/browser/download/save_package.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 user_canceled_ = true; | 234 user_canceled_ = true; |
| 235 else | 235 else |
| 236 disk_error_occurred_ = true; | 236 disk_error_occurred_ = true; |
| 237 Stop(); | 237 Stop(); |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 // Init() can be called directly, or indirectly via GetSaveInfo(). In both | 241 // Init() can be called directly, or indirectly via GetSaveInfo(). In both |
| 242 // cases, we need file_manager_ to be initialized, so we do this first. | 242 // cases, we need file_manager_ to be initialized, so we do this first. |
| 243 void SavePackage::InternalInit() { | 243 void SavePackage::InternalInit() { |
| 244 ResourceDispatcherHost* rdh = | 244 file_manager_ = ResourceDispatcherHost::Get()->save_file_manager(); |
| 245 content::GetContentClient()->browser()->GetResourceDispatcherHost(); | |
| 246 if (!rdh) { | |
| 247 NOTREACHED(); | |
| 248 return; | |
| 249 } | |
| 250 | |
| 251 file_manager_ = rdh->save_file_manager(); | |
| 252 DCHECK(file_manager_); | 245 DCHECK(file_manager_); |
| 253 | 246 |
| 254 download_manager_ = web_contents()->GetBrowserContext()->GetDownloadManager(); | 247 download_manager_ = web_contents()->GetBrowserContext()->GetDownloadManager(); |
| 255 DCHECK(download_manager_); | 248 DCHECK(download_manager_); |
| 256 } | 249 } |
| 257 | 250 |
| 258 bool SavePackage::Init() { | 251 bool SavePackage::Init() { |
| 259 // Set proper running state. | 252 // Set proper running state. |
| 260 if (wait_state_ != INITIALIZE) | 253 if (wait_state_ != INITIALIZE) |
| 261 return false; | 254 return false; |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 StopObservation(); | 1290 StopObservation(); |
| 1298 } | 1291 } |
| 1299 | 1292 |
| 1300 void SavePackage::FinalizeDownloadEntry() { | 1293 void SavePackage::FinalizeDownloadEntry() { |
| 1301 DCHECK(download_); | 1294 DCHECK(download_); |
| 1302 DCHECK(download_manager_); | 1295 DCHECK(download_manager_); |
| 1303 | 1296 |
| 1304 download_manager_->SavePageDownloadFinished(download_); | 1297 download_manager_->SavePageDownloadFinished(download_); |
| 1305 StopObservation(); | 1298 StopObservation(); |
| 1306 } | 1299 } |
| OLD | NEW |