| 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/string_piece.h" | 11 #include "base/string_piece.h" | 
| 11 #include "base/thread.h" | 12 #include "base/thread.h" | 
| 12 #include "base/values.h" | 13 #include "base/values.h" | 
| 13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" | 
| 14 #include "chrome/browser/chrome_thread.h" | 15 #include "chrome/browser/chrome_thread.h" | 
| 15 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 16 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 
| 16 #include "chrome/browser/dom_ui/fileicon_source.h" | 17 #include "chrome/browser/dom_ui/fileicon_source.h" | 
| 17 #include "chrome/browser/metrics/user_metrics.h" | 18 #include "chrome/browser/metrics/user_metrics.h" | 
| 18 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" | 
| 19 #include "chrome/browser/tab_contents/tab_contents.h" | 20 #include "chrome/browser/tab_contents/tab_contents.h" | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 47 }; | 48 }; | 
| 48 | 49 | 
| 49 } // namespace | 50 } // namespace | 
| 50 | 51 | 
| 51 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) | 52 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) | 
| 52     : search_text_(), | 53     : search_text_(), | 
| 53       download_manager_(dlm) { | 54       download_manager_(dlm) { | 
| 54   // Create our fileicon data source. | 55   // Create our fileicon data source. | 
| 55   ChromeThread::PostTask( | 56   ChromeThread::PostTask( | 
| 56       ChromeThread::IO, FROM_HERE, | 57       ChromeThread::IO, FROM_HERE, | 
| 57       NewRunnableMethod(&chrome_url_data_manager, | 58       NewRunnableMethod(Singleton<ChromeURLDataManager>().get(), | 
| 58                         &ChromeURLDataManager::AddDataSource, | 59                         &ChromeURLDataManager::AddDataSource, | 
| 59                         new FileIconSource())); | 60                         new FileIconSource())); | 
| 60 } | 61 } | 
| 61 | 62 | 
| 62 DownloadsDOMHandler::~DownloadsDOMHandler() { | 63 DownloadsDOMHandler::~DownloadsDOMHandler() { | 
| 63   ClearDownloadItems(); | 64   ClearDownloadItems(); | 
| 64   download_manager_->RemoveObserver(this); | 65   download_manager_->RemoveObserver(this); | 
| 65 } | 66 } | 
| 66 | 67 | 
| 67 // DownloadsDOMHandler, public: ----------------------------------------------- | 68 // DownloadsDOMHandler, public: ----------------------------------------------- | 
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 355   else if (download->TimeRemaining(&remaining)) | 356   else if (download->TimeRemaining(&remaining)) | 
| 356     time_remaining = TimeFormat::TimeRemaining(remaining); | 357     time_remaining = TimeFormat::TimeRemaining(remaining); | 
| 357 | 358 | 
| 358   if (time_remaining.empty()) { | 359   if (time_remaining.empty()) { | 
| 359     return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, | 360     return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, | 
| 360                                  speed_text, amount); | 361                                  speed_text, amount); | 
| 361   } | 362   } | 
| 362   return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, | 363   return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, | 
| 363                                amount, time_remaining); | 364                                amount, time_remaining); | 
| 364 } | 365 } | 
| OLD | NEW | 
|---|