| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 #endif // USE_X11 | 482 #endif // USE_X11 |
| 483 | 483 |
| 484 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) { | 484 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) { |
| 485 DictionaryValue* file_value = new DictionaryValue(); | 485 DictionaryValue* file_value = new DictionaryValue(); |
| 486 | 486 |
| 487 file_value->SetInteger("started", | 487 file_value->SetInteger("started", |
| 488 static_cast<int>(download->start_time().ToTimeT())); | 488 static_cast<int>(download->start_time().ToTimeT())); |
| 489 file_value->SetString("since_string", | 489 file_value->SetString("since_string", |
| 490 TimeFormat::RelativeDate(download->start_time(), NULL)); | 490 TimeFormat::RelativeDate(download->start_time(), NULL)); |
| 491 file_value->SetString("date_string", | 491 file_value->SetString("date_string", |
| 492 WideToUTF16Hack(base::TimeFormatShortDate(download->start_time()))); | 492 base::TimeFormatShortDate(download->start_time())); |
| 493 file_value->SetInteger("id", id); | 493 file_value->SetInteger("id", id); |
| 494 file_value->SetString("file_path", | 494 file_value->SetString("file_path", |
| 495 WideToUTF16Hack(download->GetTargetFilePath().ToWStringHack())); | 495 WideToUTF16Hack(download->GetTargetFilePath().ToWStringHack())); |
| 496 // Keep file names as LTR. | 496 // Keep file names as LTR. |
| 497 string16 file_name = WideToUTF16Hack( | 497 string16 file_name = WideToUTF16Hack( |
| 498 download->GetFileNameToReportUser().ToWStringHack()); | 498 download->GetFileNameToReportUser().ToWStringHack()); |
| 499 file_name = base::i18n::GetDisplayStringInLTRDirectionality(file_name); | 499 file_name = base::i18n::GetDisplayStringInLTRDirectionality(file_name); |
| 500 file_value->SetString("file_name", file_name); | 500 file_value->SetString("file_name", file_name); |
| 501 file_value->SetString("url", download->url().spec()); | 501 file_value->SetString("url", download->url().spec()); |
| 502 file_value->SetBoolean("otr", download->is_otr()); | 502 file_value->SetBoolean("otr", download->is_otr()); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { | 736 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { |
| 737 // Extensions that are not from the gallery are considered dangerous. | 737 // Extensions that are not from the gallery are considered dangerous. |
| 738 return true; | 738 return true; |
| 739 } | 739 } |
| 740 } | 740 } |
| 741 | 741 |
| 742 return false; | 742 return false; |
| 743 } | 743 } |
| 744 | 744 |
| 745 } // namespace download_util | 745 } // namespace download_util |
| OLD | NEW |