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 ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get(); |
245 content::GetContentClient()->browser()->GetResourceDispatcherHost(); | |
246 if (!rdh) { | 245 if (!rdh) { |
247 NOTREACHED(); | 246 NOTREACHED(); |
248 return; | 247 return; |
249 } | 248 } |
250 | 249 |
251 file_manager_ = rdh->save_file_manager(); | 250 file_manager_ = rdh->save_file_manager(); |
252 DCHECK(file_manager_); | 251 DCHECK(file_manager_); |
253 | 252 |
254 download_manager_ = web_contents()->GetBrowserContext()->GetDownloadManager(); | 253 download_manager_ = web_contents()->GetBrowserContext()->GetDownloadManager(); |
255 DCHECK(download_manager_); | 254 DCHECK(download_manager_); |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 StopObservation(); | 1296 StopObservation(); |
1298 } | 1297 } |
1299 | 1298 |
1300 void SavePackage::FinalizeDownloadEntry() { | 1299 void SavePackage::FinalizeDownloadEntry() { |
1301 DCHECK(download_); | 1300 DCHECK(download_); |
1302 DCHECK(download_manager_); | 1301 DCHECK(download_manager_); |
1303 | 1302 |
1304 download_manager_->SavePageDownloadFinished(download_); | 1303 download_manager_->SavePageDownloadFinished(download_); |
1305 StopObservation(); | 1304 StopObservation(); |
1306 } | 1305 } |
OLD | NEW |