| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 21 matching lines...) Expand all Loading... |
| 32 #include "content/browser/download/download_item.h" | 32 #include "content/browser/download/download_item.h" |
| 33 #include "content/browser/tab_contents/tab_contents.h" | 33 #include "content/browser/tab_contents/tab_contents.h" |
| 34 #include "content/browser/user_metrics.h" | 34 #include "content/browser/user_metrics.h" |
| 35 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 36 #include "ui/gfx/image/image.h" | 36 #include "ui/gfx/image/image.h" |
| 37 | 37 |
| 38 #if !defined(OS_MACOSX) | 38 #if !defined(OS_MACOSX) |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 using content::BrowserThread; |
| 43 |
| 42 namespace { | 44 namespace { |
| 43 | 45 |
| 44 // Maximum number of downloads to show. TODO(glen): Remove this and instead | 46 // Maximum number of downloads to show. TODO(glen): Remove this and instead |
| 45 // stuff the downloads down the pipe slowly. | 47 // stuff the downloads down the pipe slowly. |
| 46 static const int kMaxDownloads = 150; | 48 static const int kMaxDownloads = 150; |
| 47 | 49 |
| 48 // Sort DownloadItems into descending order by their start time. | 50 // Sort DownloadItems into descending order by their start time. |
| 49 class DownloadItemSorter : public std::binary_function<DownloadItem*, | 51 class DownloadItemSorter : public std::binary_function<DownloadItem*, |
| 50 DownloadItem*, | 52 DownloadItem*, |
| 51 bool> { | 53 bool> { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 return NULL; | 405 return NULL; |
| 404 } | 406 } |
| 405 | 407 |
| 406 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 408 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 407 int id; | 409 int id; |
| 408 if (ExtractIntegerValue(args, &id)) { | 410 if (ExtractIntegerValue(args, &id)) { |
| 409 return GetDownloadById(id); | 411 return GetDownloadById(id); |
| 410 } | 412 } |
| 411 return NULL; | 413 return NULL; |
| 412 } | 414 } |
| OLD | NEW |