| 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 "chrome/browser/download/download_status_updater.h" | 5 #include "chrome/browser/download/download_status_updater.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 void DownloadStatusUpdater::AddManager(content::DownloadManager* manager) { | 47 void DownloadStatusUpdater::AddManager(content::DownloadManager* manager) { |
| 48 DCHECK(!ContainsKey(managers_, manager)); | 48 DCHECK(!ContainsKey(managers_, manager)); |
| 49 managers_.insert(manager); | 49 managers_.insert(manager); |
| 50 manager->AddObserver(this); | 50 manager->AddObserver(this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Methods inherited from content::DownloadManager::Observer. | 53 // Methods inherited from content::DownloadManager::Observer. |
| 54 void DownloadStatusUpdater::ModelChanged(content::DownloadManager* manager) { | 54 void DownloadStatusUpdater::ModelChanged(content::DownloadManager* manager) { |
| 55 std::vector<content::DownloadItem*> downloads; | 55 std::vector<content::DownloadItem*> downloads; |
| 56 manager->SearchDownloads(string16(), &downloads); | 56 manager->GetAllDownloads(&downloads); |
| 57 | 57 |
| 58 std::vector<content::DownloadItem*> added_downloads; | 58 std::vector<content::DownloadItem*> added_downloads; |
| 59 for (std::vector<content::DownloadItem*>::iterator it = downloads.begin(); | 59 for (std::vector<content::DownloadItem*>::iterator it = downloads.begin(); |
| 60 it != downloads.end(); ++it) { | 60 it != downloads.end(); ++it) { |
| 61 if (UpdateItem(*it)) | 61 if (!(*it)->IsTemporary() && UpdateItem(*it)) |
| 62 added_downloads.push_back(*it); | 62 added_downloads.push_back(*it); |
| 63 } | 63 } |
| 64 | 64 |
| 65 for (std::vector<content::DownloadItem*>::iterator it = | 65 for (std::vector<content::DownloadItem*>::iterator it = |
| 66 added_downloads.begin(); | 66 added_downloads.begin(); |
| 67 it != added_downloads.end(); | 67 it != added_downloads.end(); |
| 68 ++it) { | 68 ++it) { |
| 69 UpdateAppIconDownloadProgress(*it); | 69 UpdateAppIconDownloadProgress(*it); |
| 70 } | 70 } |
| 71 } | 71 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 } else { | 118 } else { |
| 119 if (ContainsKey(items_, download)) { | 119 if (ContainsKey(items_, download)) { |
| 120 items_.erase(download); | 120 items_.erase(download); |
| 121 download->RemoveObserver(this); | 121 download->RemoveObserver(this); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 return false; | 125 return false; |
| 126 } | 126 } |
| OLD | NEW |