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/ui/webui/downloads_dom_handler.h" | 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 &download_items_); | 205 &download_items_); |
206 // If we have a parent DownloadManager, let it add its downloads to the | 206 // If we have a parent DownloadManager, let it add its downloads to the |
207 // results. | 207 // results. |
208 if (original_profile_download_manager_) { | 208 if (original_profile_download_manager_) { |
209 original_profile_download_manager_->SearchDownloads( | 209 original_profile_download_manager_->SearchDownloads( |
210 WideToUTF16(search_text_), &download_items_); | 210 WideToUTF16(search_text_), &download_items_); |
211 } | 211 } |
212 | 212 |
213 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter()); | 213 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter()); |
214 | 214 |
215 // Remove any extension downloads. | 215 // Remove any extension downloads and hidden downloads. |
216 for (size_t i = 0; i < download_items_.size();) { | 216 for (size_t i = 0; i < download_items_.size();) { |
217 if (download_crx_util::IsExtensionDownload(*download_items_[i])) | 217 if (download_crx_util::IsExtensionDownload(*download_items_[i]) || |
| 218 DownloadHidden::Get(download_items_[i])) |
218 download_items_.erase(download_items_.begin() + i); | 219 download_items_.erase(download_items_.begin() + i); |
219 else | 220 else |
220 i++; | 221 i++; |
221 } | 222 } |
222 | 223 |
223 // Add ourself to all download items as an observer. | 224 // Add ourself to all download items as an observer. |
224 for (OrderedDownloads::iterator it = download_items_.begin(); | 225 for (OrderedDownloads::iterator it = download_items_.begin(); |
225 it != download_items_.end(); ++it) { | 226 it != download_items_.end(); ++it) { |
226 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads) | 227 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads) |
227 break; | 228 break; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 | 406 |
406 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( | 407 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( |
407 const ListValue* args) { | 408 const ListValue* args) { |
408 int id; | 409 int id; |
409 if (ExtractIntegerValue(args, &id)) { | 410 if (ExtractIntegerValue(args, &id)) { |
410 return GetDownloadById(id); | 411 return GetDownloadById(id); |
411 } | 412 } |
412 return NULL; | 413 return NULL; |
413 } | 414 } |
OLD | NEW |