Chromium Code Reviews

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

Issue 1073005: Move RTL related functions from app/l10n_util to base/i18n/rtl... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/download/download_util.cc » ('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) 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/download/download_item_model.h" 5 #include "chrome/browser/download/download_item_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/i18n/number_formatting.h" 8 #include "base/i18n/number_formatting.h"
9 #include "base/i18n/rtl.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/download/download_manager.h" 11 #include "chrome/browser/download/download_manager.h"
11 #include "chrome/browser/download/save_package.h" 12 #include "chrome/browser/download/save_package.h"
12 #include "chrome/common/time_format.h" 13 #include "chrome/common/time_format.h"
13 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
14 15
15 using base::TimeDelta; 16 using base::TimeDelta;
16 17
17 // ----------------------------------------------------------------------------- 18 // -----------------------------------------------------------------------------
18 // DownloadItemModel 19 // DownloadItemModel
(...skipping 12 matching lines...)
31 32
32 DataUnits amount_units = GetByteDisplayUnits(total); 33 DataUnits amount_units = GetByteDisplayUnits(total);
33 const std::wstring simple_size = FormatBytes(size, amount_units, false); 34 const std::wstring simple_size = FormatBytes(size, amount_units, false);
34 35
35 // In RTL locales, we render the text "size/total" in an RTL context. This 36 // In RTL locales, we render the text "size/total" in an RTL context. This
36 // is problematic since a string such as "123/456 MB" is displayed 37 // is problematic since a string such as "123/456 MB" is displayed
37 // as "MB 123/456" because it ends with an LTR run. In order to solve this, 38 // as "MB 123/456" because it ends with an LTR run. In order to solve this,
38 // we mark the total string as an LTR string if the UI layout is 39 // we mark the total string as an LTR string if the UI layout is
39 // right-to-left so that the string "456 MB" is treated as an LTR run. 40 // right-to-left so that the string "456 MB" is treated as an LTR run.
40 std::wstring simple_total = FormatBytes(total, amount_units, true); 41 std::wstring simple_total = FormatBytes(total, amount_units, true);
41 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) 42 if (base::i18n::IsRTL())
42 l10n_util::WrapStringWithLTRFormatting(&simple_total); 43 base::i18n::WrapStringWithLTRFormatting(&simple_total);
43 44
44 TimeDelta remaining; 45 TimeDelta remaining;
45 std::wstring simple_time; 46 std::wstring simple_time;
46 if (download_->state() == DownloadItem::IN_PROGRESS && 47 if (download_->state() == DownloadItem::IN_PROGRESS &&
47 download_->is_paused()) { 48 download_->is_paused()) {
48 simple_time = l10n_util::GetString(IDS_DOWNLOAD_PROGRESS_PAUSED); 49 simple_time = l10n_util::GetString(IDS_DOWNLOAD_PROGRESS_PAUSED);
49 } else if (download_->TimeRemaining(&remaining)) { 50 } else if (download_->TimeRemaining(&remaining)) {
50 simple_time = download_->open_when_complete() ? 51 simple_time = download_->open_when_complete() ?
51 TimeFormat::TimeRemainingShort(remaining) : 52 TimeFormat::TimeRemainingShort(remaining) :
52 TimeFormat::TimeRemaining(remaining); 53 TimeFormat::TimeRemaining(remaining);
(...skipping 70 matching lines...)
123 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELED); 124 status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELED);
124 break; 125 break;
125 case DownloadItem::REMOVING: 126 case DownloadItem::REMOVING:
126 break; 127 break;
127 default: 128 default:
128 NOTREACHED(); 129 NOTREACHED();
129 } 130 }
130 131
131 return status_text; 132 return status_text;
132 } 133 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.cc ('k') | chrome/browser/download/download_util.cc » ('j') | no next file with comments »

Powered by Google App Engine