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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 | 93 |
94 // React to a transition that a download associated with one of our | 94 // React to a transition that a download associated with one of our |
95 // download managers has made. Our goal is to have only IN_PROGRESS | 95 // download managers has made. Our goal is to have only IN_PROGRESS |
96 // items on our set list, as they're the only ones that have relevance | 96 // items on our set list, as they're the only ones that have relevance |
97 // to GetProgress() return values. | 97 // to GetProgress() return values. |
98 void DownloadStatusUpdater::UpdateItem(content::DownloadItem* download) { | 98 void DownloadStatusUpdater::UpdateItem(content::DownloadItem* download) { |
99 if (download->GetState() == content::DownloadItem::IN_PROGRESS) { | 99 if (download->GetState() == content::DownloadItem::IN_PROGRESS) { |
100 if (!ContainsKey(items_, download)) { | 100 if (!ContainsKey(items_, download)) { |
101 items_.insert(download); | 101 items_.insert(download); |
102 download->AddObserver(this); | 102 download->AddObserver(this); |
103 UpdateDownloadProgressForItemStarted(download); | |
104 } else { | |
105 UpdateDownloadProgressForItemProgressed(download); | |
103 } | 106 } |
104 } else { | 107 } else { |
105 if (ContainsKey(items_, download)) { | 108 if (ContainsKey(items_, download)) { |
109 UpdateDownloadProgressForItemCompleted(download); | |
asanka
2012/08/09 15:23:24
This is going to be called for states other than C
Avi (use Gerrit)
2012/08/09 19:04:23
Oops. Fixed.
| |
106 items_.erase(download); | 110 items_.erase(download); |
107 download->RemoveObserver(this); | 111 download->RemoveObserver(this); |
108 } | 112 } |
109 } | 113 } |
110 } | 114 } |
115 | |
116 // All platforms track overall download progress via | |
117 // UpdateAppIconDownloadProgress(); these allow for tracking the progress of | |
118 // individual downloads. | |
119 #if !defined(OS_MACOSX) && !defined(OS_WIN) | |
120 void DownloadStatusUpdater::UpdateDownloadProgressForItemStarted( | |
121 content::DownloadItem* download) { | |
122 } | |
123 | |
124 void DownloadStatusUpdater::UpdateDownloadProgressForItemProgressed( | |
125 content::DownloadItem* download) { | |
126 } | |
127 | |
128 void DownloadStatusUpdater::UpdateDownloadProgressForItemCompleted( | |
129 content::DownloadItem* download) { | |
130 } | |
131 #endif // OS_MACOSX | |
OLD | NEW |