| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/downloads_dom_handler.h" | 5 #include "chrome/browser/dom_ui/downloads_dom_handler.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/thread.h" | 12 #include "base/thread.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" |
| 16 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 16 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 17 #include "chrome/browser/dom_ui/fileicon_source.h" | 17 #include "chrome/browser/dom_ui/fileicon_source.h" |
| 18 #include "chrome/browser/download/download_util.h" |
| 18 #include "chrome/browser/metrics/user_metrics.h" | 19 #include "chrome/browser/metrics/user_metrics.h" |
| 19 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 21 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #include "chrome/common/jstemplate_builder.h" | 22 #include "chrome/common/jstemplate_builder.h" |
| 22 #include "chrome/common/time_format.h" | 23 #include "chrome/common/time_format.h" |
| 23 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
| 24 #include "grit/browser_resources.h" | 25 #include "grit/browser_resources.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 | 27 |
| 27 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | |
| 28 // TODO(port): re-enable when download_util is ported | |
| 29 #include "chrome/browser/download/download_util.h" | |
| 30 #else | |
| 31 #include "chrome/common/temp_scaffolding_stubs.h" | |
| 32 #endif | |
| 33 | |
| 34 namespace { | 28 namespace { |
| 35 | 29 |
| 36 // Maximum number of downloads to show. TODO(glen): Remove this and instead | 30 // Maximum number of downloads to show. TODO(glen): Remove this and instead |
| 37 // stuff the downloads down the pipe slowly. | 31 // stuff the downloads down the pipe slowly. |
| 38 static const int kMaxDownloads = 150; | 32 static const int kMaxDownloads = 150; |
| 39 | 33 |
| 40 // Sort DownloadItems into descending order by their start time. | 34 // Sort DownloadItems into descending order by their start time. |
| 41 class DownloadItemSorter : public std::binary_function<DownloadItem*, | 35 class DownloadItemSorter : public std::binary_function<DownloadItem*, |
| 42 DownloadItem*, | 36 DownloadItem*, |
| 43 bool> { | 37 bool> { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 else if (download->TimeRemaining(&remaining)) | 350 else if (download->TimeRemaining(&remaining)) |
| 357 time_remaining = TimeFormat::TimeRemaining(remaining); | 351 time_remaining = TimeFormat::TimeRemaining(remaining); |
| 358 | 352 |
| 359 if (time_remaining.empty()) { | 353 if (time_remaining.empty()) { |
| 360 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, | 354 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, |
| 361 speed_text, amount); | 355 speed_text, amount); |
| 362 } | 356 } |
| 363 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, | 357 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, |
| 364 amount, time_remaining); | 358 amount, time_remaining); |
| 365 } | 359 } |
| OLD | NEW |