Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: chrome/browser/dom_ui/downloads_dom_handler.cc

Issue 342020: First of several patches to get rid of MessageLoop caching now that we have C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/string_piece.h" 10 #include "base/string_piece.h"
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chrome_thread.h"
14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 15 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
15 #include "chrome/browser/dom_ui/fileicon_source.h" 16 #include "chrome/browser/dom_ui/fileicon_source.h"
16 #include "chrome/browser/metrics/user_metrics.h" 17 #include "chrome/browser/metrics/user_metrics.h"
17 #include "chrome/browser/profile.h" 18 #include "chrome/browser/profile.h"
18 #include "chrome/browser/tab_contents/tab_contents.h" 19 #include "chrome/browser/tab_contents/tab_contents.h"
19 #include "chrome/common/jstemplate_builder.h" 20 #include "chrome/common/jstemplate_builder.h"
20 #include "chrome/common/time_format.h" 21 #include "chrome/common/time_format.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "grit/browser_resources.h" 23 #include "grit/browser_resources.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
(...skipping 20 matching lines...) Expand all
44 return lhs->start_time() > rhs->start_time(); 45 return lhs->start_time() > rhs->start_time();
45 } 46 }
46 }; 47 };
47 48
48 } // namespace 49 } // namespace
49 50
50 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) 51 DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm)
51 : search_text_(), 52 : search_text_(),
52 download_manager_(dlm) { 53 download_manager_(dlm) {
53 // Create our fileicon data source. 54 // Create our fileicon data source.
54 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 55 ChromeThread::PostTask(
56 ChromeThread::IO, FROM_HERE,
55 NewRunnableMethod(&chrome_url_data_manager, 57 NewRunnableMethod(&chrome_url_data_manager,
56 &ChromeURLDataManager::AddDataSource, 58 &ChromeURLDataManager::AddDataSource,
57 new FileIconSource())); 59 new FileIconSource()));
58 } 60 }
59 61
60 DownloadsDOMHandler::~DownloadsDOMHandler() { 62 DownloadsDOMHandler::~DownloadsDOMHandler() {
61 ClearDownloadItems(); 63 ClearDownloadItems();
62 download_manager_->RemoveObserver(this); 64 download_manager_->RemoveObserver(this);
63 } 65 }
64 66
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 else if (download->TimeRemaining(&remaining)) 355 else if (download->TimeRemaining(&remaining))
354 time_remaining = TimeFormat::TimeRemaining(remaining); 356 time_remaining = TimeFormat::TimeRemaining(remaining);
355 357
356 if (time_remaining.empty()) { 358 if (time_remaining.empty()) {
357 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, 359 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN,
358 speed_text, amount); 360 speed_text, amount);
359 } 361 }
360 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, 362 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text,
361 amount, time_remaining); 363 amount, time_remaining);
362 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698