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

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

Issue 55002: Add date information to the downloads page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months 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
« no previous file with comments | « no previous file | chrome/browser/resources/downloads.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_ui.h" 5 #include "chrome/browser/dom_ui/downloads_ui.h"
6 6
7 #include "base/gfx/png_encoder.h" 7 #include "base/gfx/png_encoder.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/thread.h" 9 #include "base/thread.h"
10 #include "base/time_format.h" 10 #include "base/time_format.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 372
373 dom_ui_->CallJavascriptFunction(L"downloadsList", results_value); 373 dom_ui_->CallJavascriptFunction(L"downloadsList", results_value);
374 } 374 }
375 375
376 DictionaryValue* DownloadsDOMHandler::CreateDownloadItemValue( 376 DictionaryValue* DownloadsDOMHandler::CreateDownloadItemValue(
377 DownloadItem* download, int id) { 377 DownloadItem* download, int id) {
378 DictionaryValue* file_value = new DictionaryValue(); 378 DictionaryValue* file_value = new DictionaryValue();
379 379
380 file_value->SetInteger(L"started", 380 file_value->SetInteger(L"started",
381 static_cast<int>(download->start_time().ToTimeT())); 381 static_cast<int>(download->start_time().ToTimeT()));
382 file_value->SetString(L"since_string",
383 TimeFormat::RelativeDate(download->start_time(), NULL));
384 file_value->SetString(L"date_string",
385 base::TimeFormatShortDate(download->start_time()));
382 file_value->SetInteger(L"id", id); 386 file_value->SetInteger(L"id", id);
383 file_value->SetString(L"file_path", download->full_path().ToWStringHack()); 387 file_value->SetString(L"file_path", download->full_path().ToWStringHack());
384 file_value->SetString(L"file_name", download->GetFileName().ToWStringHack()); 388 file_value->SetString(L"file_name", download->GetFileName().ToWStringHack());
385 file_value->SetString(L"url", download->url().spec()); 389 file_value->SetString(L"url", download->url().spec());
386 390
387 if (download->state() == DownloadItem::IN_PROGRESS) { 391 if (download->state() == DownloadItem::IN_PROGRESS) {
388 if (download->safety_state() == DownloadItem::DANGEROUS) { 392 if (download->safety_state() == DownloadItem::DANGEROUS) {
389 file_value->SetString(L"state", L"DANGEROUS"); 393 file_value->SetString(L"state", L"DANGEROUS");
390 } else if (download->is_paused()) { 394 } else if (download->is_paused()) {
391 file_value->SetString(L"state", L"PAUSED"); 395 file_value->SetString(L"state", L"PAUSED");
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 handler->Init(); 504 handler->Init();
501 505
502 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource(); 506 DownloadsUIHTMLSource* html_source = new DownloadsUIHTMLSource();
503 507
504 // Set up the chrome-ui://downloads/ source. 508 // Set up the chrome-ui://downloads/ source.
505 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 509 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
506 NewRunnableMethod(&chrome_url_data_manager, 510 NewRunnableMethod(&chrome_url_data_manager,
507 &ChromeURLDataManager::AddDataSource, 511 &ChromeURLDataManager::AddDataSource,
508 html_source)); 512 html_source));
509 } 513 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/downloads.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698