| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <time.h> | 5 #include <time.h> |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_manager.h" | 7 #include "chrome/browser/download/download_manager.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // 'dangerous_finished_' contains all complete downloads that have not been | 351 // 'dangerous_finished_' contains all complete downloads that have not been |
| 352 // approved. They should be removed. | 352 // approved. They should be removed. |
| 353 it = dangerous_finished_.begin(); | 353 it = dangerous_finished_.begin(); |
| 354 for (; it != dangerous_finished_.end(); ++it) | 354 for (; it != dangerous_finished_.end(); ++it) |
| 355 to_remove.insert(it->second); | 355 to_remove.insert(it->second); |
| 356 | 356 |
| 357 // Remove the dangerous download that are not approved. | 357 // Remove the dangerous download that are not approved. |
| 358 for (std::set<DownloadItem*>::const_iterator rm_it = to_remove.begin(); | 358 for (std::set<DownloadItem*>::const_iterator rm_it = to_remove.begin(); |
| 359 rm_it != to_remove.end(); ++rm_it) { | 359 rm_it != to_remove.end(); ++rm_it) { |
| 360 DownloadItem* download = *rm_it; | 360 DownloadItem* download = *rm_it; |
| 361 int64 handle = download->db_handle(); |
| 361 download->Remove(true); | 362 download->Remove(true); |
| 362 // Same as above, delete the download if it is not in 'downloads_'. | 363 // Same as above, delete the download if it is not in 'downloads_' (as the |
| 363 if (download->db_handle() == kUninitializedHandle) | 364 // Remove() call above won't have deleted it). |
| 365 if (handle == kUninitializedHandle) |
| 364 delete download; | 366 delete download; |
| 365 } | 367 } |
| 366 to_remove.clear(); | 368 to_remove.clear(); |
| 367 | 369 |
| 368 in_progress_.clear(); | 370 in_progress_.clear(); |
| 369 dangerous_finished_.clear(); | 371 dangerous_finished_.clear(); |
| 370 STLDeleteValues(&downloads_); | 372 STLDeleteValues(&downloads_); |
| 371 | 373 |
| 372 file_manager_ = NULL; | 374 file_manager_ = NULL; |
| 373 | 375 |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 for (std::vector<int64>::iterator it = results->begin(); | 1277 for (std::vector<int64>::iterator it = results->begin(); |
| 1276 it != results->end(); ++it) { | 1278 it != results->end(); ++it) { |
| 1277 DownloadMap::iterator dit = downloads_.find(*it); | 1279 DownloadMap::iterator dit = downloads_.find(*it); |
| 1278 if (dit != downloads_.end()) | 1280 if (dit != downloads_.end()) |
| 1279 searched_downloads.push_back(dit->second); | 1281 searched_downloads.push_back(dit->second); |
| 1280 } | 1282 } |
| 1281 | 1283 |
| 1282 requestor->SetDownloads(searched_downloads); | 1284 requestor->SetDownloads(searched_downloads); |
| 1283 } | 1285 } |
| 1284 | 1286 |
| OLD | NEW |