| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/download/download_history.h" | 18 #include "chrome/browser/download/download_history.h" |
| 19 #include "chrome/browser/download/download_item.h" | |
| 20 #include "chrome/browser/download/download_prefs.h" | 19 #include "chrome/browser/download/download_prefs.h" |
| 21 #include "chrome/browser/download/download_util.h" | 20 #include "chrome/browser/download/download_util.h" |
| 22 #include "chrome/browser/platform_util.h" | 21 #include "chrome/browser/platform_util.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 23 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 25 #include "chrome/browser/ui/webui/fileicon_source.h" | 24 #include "chrome/browser/ui/webui/fileicon_source.h" |
| 26 #include "chrome/browser/ui/webui/fileicon_source_cros.h" | 25 #include "chrome/browser/ui/webui/fileicon_source_cros.h" |
| 27 #include "chrome/common/jstemplate_builder.h" | 26 #include "chrome/common/jstemplate_builder.h" |
| 28 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 29 #include "content/browser/browser_thread.h" | 28 #include "content/browser/browser_thread.h" |
| 29 #include "content/browser/download/download_item.h" |
| 30 #include "content/browser/tab_contents/tab_contents.h" | 30 #include "content/browser/tab_contents/tab_contents.h" |
| 31 #include "content/browser/user_metrics.h" | 31 #include "content/browser/user_metrics.h" |
| 32 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
| 33 #include "ui/gfx/image/image.h" | 33 #include "ui/gfx/image/image.h" |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // Maximum number of downloads to show. TODO(glen): Remove this and instead | 37 // Maximum number of downloads to show. TODO(glen): Remove this and instead |
| 38 // stuff the downloads down the pipe slowly. | 38 // stuff the downloads down the pipe slowly. |
| 39 static const int kMaxDownloads = 150; | 39 static const int kMaxDownloads = 150; |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 return NULL; | 283 return NULL; |
| 284 } | 284 } |
| 285 | 285 |
| 286 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { | 286 DownloadItem* DownloadsDOMHandler::GetDownloadByValue(const ListValue* args) { |
| 287 int id; | 287 int id; |
| 288 if (ExtractIntegerValue(args, &id)) { | 288 if (ExtractIntegerValue(args, &id)) { |
| 289 return GetDownloadById(id); | 289 return GetDownloadById(id); |
| 290 } | 290 } |
| 291 return NULL; | 291 return NULL; |
| 292 } | 292 } |
| OLD | NEW |