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

Side by Side Diff: chrome/browser/download/download_util.cc

Issue 3108027: Convert GetDisplayStringInLTRDirectionality from wstring to string16. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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
OLDNEW
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 file_value->SetInteger("started", 541 file_value->SetInteger("started",
542 static_cast<int>(download->start_time().ToTimeT())); 542 static_cast<int>(download->start_time().ToTimeT()));
543 file_value->SetString("since_string", 543 file_value->SetString("since_string",
544 TimeFormat::RelativeDate(download->start_time(), NULL)); 544 TimeFormat::RelativeDate(download->start_time(), NULL));
545 file_value->SetString("date_string", 545 file_value->SetString("date_string",
546 WideToUTF16Hack(base::TimeFormatShortDate(download->start_time()))); 546 WideToUTF16Hack(base::TimeFormatShortDate(download->start_time())));
547 file_value->SetInteger("id", id); 547 file_value->SetInteger("id", id);
548 file_value->SetString("file_path", 548 file_value->SetString("file_path",
549 WideToUTF16Hack(download->full_path().ToWStringHack())); 549 WideToUTF16Hack(download->full_path().ToWStringHack()));
550 // Keep file names as LTR. 550 // Keep file names as LTR.
551 std::wstring file_name = download->GetFileName().ToWStringHack(); 551 string16 file_name = WideToUTF16Hack(
552 base::i18n::GetDisplayStringInLTRDirectionality(&file_name); 552 download->GetFileName().ToWStringHack());
553 file_value->SetString("file_name", WideToUTF16Hack(file_name)); 553 file_name = base::i18n::GetDisplayStringInLTRDirectionality(file_name);
554 file_value->SetString("file_name", file_name);
554 file_value->SetString("url", download->url().spec()); 555 file_value->SetString("url", download->url().spec());
555 file_value->SetBoolean("otr", download->is_otr()); 556 file_value->SetBoolean("otr", download->is_otr());
556 557
557 if (download->state() == DownloadItem::IN_PROGRESS) { 558 if (download->state() == DownloadItem::IN_PROGRESS) {
558 if (download->safety_state() == DownloadItem::DANGEROUS) { 559 if (download->safety_state() == DownloadItem::DANGEROUS) {
559 file_value->SetString("state", "DANGEROUS"); 560 file_value->SetString("state", "DANGEROUS");
560 } else if (download->is_paused()) { 561 } else if (download->is_paused()) {
561 file_value->SetString("state", "PAUSED"); 562 file_value->SetString("state", "PAUSED");
562 } else { 563 } else {
563 file_value->SetString("state", "IN_PROGRESS"); 564 file_value->SetString("state", "IN_PROGRESS");
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 755 }
755 756
756 FilePath GetCrDownloadPath(const FilePath& suggested_path) { 757 FilePath GetCrDownloadPath(const FilePath& suggested_path) {
757 FilePath::StringType file_name; 758 FilePath::StringType file_name;
758 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), 759 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"),
759 suggested_path.value().c_str()); 760 suggested_path.value().c_str());
760 return FilePath(file_name); 761 return FilePath(file_name);
761 } 762 }
762 763
763 } // namespace download_util 764 } // namespace download_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698