| 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 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/download/download_service_factory.h" | 24 #include "chrome/browser/download/download_service_factory.h" |
| 25 #include "chrome/browser/download/download_util.h" | 25 #include "chrome/browser/download/download_util.h" |
| 26 #include "chrome/browser/platform_util.h" | 26 #include "chrome/browser/platform_util.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 28 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 29 #include "chrome/browser/ui/webui/fileicon_source.h" | 29 #include "chrome/browser/ui/webui/fileicon_source.h" |
| 30 #include "chrome/browser/ui/webui/fileicon_source_chromeos.h" | 30 #include "chrome/browser/ui/webui/fileicon_source_chromeos.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 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/public/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 #if defined(OS_CHROMEOS) | 42 #if defined(OS_CHROMEOS) |
| 43 #include "chrome/browser/extensions/file_manager_util.h" | 43 #include "chrome/browser/extensions/file_manager_util.h" |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 using content::BrowserThread; | 46 using content::BrowserThread; |
| 47 using content::UserMetricsAction; |
| 47 | 48 |
| 48 namespace { | 49 namespace { |
| 49 | 50 |
| 50 // Maximum number of downloads to show. TODO(glen): Remove this and instead | 51 // Maximum number of downloads to show. TODO(glen): Remove this and instead |
| 51 // stuff the downloads down the pipe slowly. | 52 // stuff the downloads down the pipe slowly. |
| 52 static const int kMaxDownloads = 150; | 53 static const int kMaxDownloads = 150; |
| 53 | 54 |
| 54 // Sort DownloadItems into descending order by their start time. | 55 // Sort DownloadItems into descending order by their start time. |
| 55 class DownloadItemSorter : public std::binary_function<DownloadItem*, | 56 class DownloadItemSorter : public std::binary_function<DownloadItem*, |
| 56 DownloadItem*, | 57 DownloadItem*, |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 return NULL; | 401 return NULL; |
| 401 } | 402 } |
| 402 | 403 |
| 403 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 404 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 404 int id; | 405 int id; |
| 405 if (ExtractIntegerValue(args, &id)) { | 406 if (ExtractIntegerValue(args, &id)) { |
| 406 return GetDownloadById(id); | 407 return GetDownloadById(id); |
| 407 } | 408 } |
| 408 return NULL; | 409 return NULL; |
| 409 } | 410 } |
| OLD | NEW |