OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/download/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // We still have some items which are waiting for start to save. | 294 // We still have some items which are waiting for start to save. |
295 SaveItem* save_item = waiting_item_queue_.front(); | 295 SaveItem* save_item = waiting_item_queue_.front(); |
296 waiting_item_queue_.pop(); | 296 waiting_item_queue_.pop(); |
297 delete save_item; | 297 delete save_item; |
298 } | 298 } |
299 | 299 |
300 STLDeleteValues(&saved_success_items_); | 300 STLDeleteValues(&saved_success_items_); |
301 STLDeleteValues(&in_progress_items_); | 301 STLDeleteValues(&in_progress_items_); |
302 STLDeleteValues(&saved_failed_items_); | 302 STLDeleteValues(&saved_failed_items_); |
303 | 303 |
304 if (download_) { | 304 // The DownloadItem is owned by DownloadManager. |
305 // We call this to remove the view from the shelf. It will invoke | 305 download_ = NULL; |
306 // DownloadManager::RemoveDownload, but since the fake DownloadItem is not | 306 |
307 // owned by DownloadManager, it will do nothing to our fake item. | |
308 download_->Remove(false); | |
309 delete download_; | |
310 download_ = NULL; | |
311 } | |
312 file_manager_ = NULL; | 307 file_manager_ = NULL; |
313 | 308 |
314 // If there's an outstanding save dialog, make sure it doesn't call us back | 309 // If there's an outstanding save dialog, make sure it doesn't call us back |
315 // now that we're gone. | 310 // now that we're gone. |
316 if (select_file_dialog_.get()) | 311 if (select_file_dialog_.get()) |
317 select_file_dialog_->ListenerDestroyed(); | 312 select_file_dialog_->ListenerDestroyed(); |
318 } | 313 } |
319 | 314 |
320 // Retrieves the URL to be saved from tab_contents_ variable. | 315 // Retrieves the URL to be saved from tab_contents_ variable. |
321 GURL SavePackage::GetUrlToBeSaved() { | 316 GURL SavePackage::GetUrlToBeSaved() { |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 int index, void* params) { | 1370 int index, void* params) { |
1376 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1371 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1377 ContinueSave(save_params, path, index); | 1372 ContinueSave(save_params, path, index); |
1378 delete save_params; | 1373 delete save_params; |
1379 } | 1374 } |
1380 | 1375 |
1381 void SavePackage::FileSelectionCanceled(void* params) { | 1376 void SavePackage::FileSelectionCanceled(void* params) { |
1382 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1377 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1383 delete save_params; | 1378 delete save_params; |
1384 } | 1379 } |
OLD | NEW |