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 #include "chrome/browser/chromeos/dom_ui/imageburner_ui.h" | 5 #include "chrome/browser/chromeos/dom_ui/imageburner_ui.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 dom_ui_->CallJavascriptFunction(L"burnProgressUpdated", progress_value); | 306 dom_ui_->CallJavascriptFunction(L"burnProgressUpdated", progress_value); |
307 } | 307 } |
308 | 308 |
309 std::wstring ImageBurnHandler::GetBurnProgressText(int64 total_burnt, | 309 std::wstring ImageBurnHandler::GetBurnProgressText(int64 total_burnt, |
310 int64 image_size) { | 310 int64 image_size) { |
311 DataUnits amount_units = GetByteDisplayUnits(total_burnt); | 311 DataUnits amount_units = GetByteDisplayUnits(total_burnt); |
312 std::wstring burnt_size = | 312 std::wstring burnt_size = |
313 UTF16ToWideHack(FormatBytes(total_burnt, amount_units, true)); | 313 UTF16ToWideHack(FormatBytes(total_burnt, amount_units, true)); |
314 | 314 |
315 std::wstring burnt_size_localized; | 315 base::i18n::AdjustStringForLocaleDirection(&burnt_size); |
316 if (base::i18n::AdjustStringForLocaleDirection(burnt_size, | |
317 &burnt_size_localized)) { | |
318 burnt_size.assign(burnt_size_localized); | |
319 } | |
320 | 316 |
321 if (image_size) { | 317 if (image_size) { |
322 amount_units = GetByteDisplayUnits(image_size); | 318 amount_units = GetByteDisplayUnits(image_size); |
323 std::wstring total_text = | 319 std::wstring total_text = |
324 UTF16ToWideHack(FormatBytes(image_size, amount_units, true)); | 320 UTF16ToWideHack(FormatBytes(image_size, amount_units, true)); |
325 std::wstring total_text_localized; | 321 base::i18n::AdjustStringForLocaleDirection(&total_text); |
326 if (base::i18n::AdjustStringForLocaleDirection(total_text, | |
327 &total_text_localized)) | |
328 total_text.assign(total_text_localized); | |
329 | 322 |
330 return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS, | 323 return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS, |
331 burnt_size, | 324 burnt_size, |
332 total_text); | 325 total_text); |
333 } else { | 326 } else { |
334 return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN, | 327 return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN, |
335 burnt_size); | 328 burnt_size); |
336 } | 329 } |
337 } | 330 } |
338 | 331 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 ImageBurnHandler* handler = new ImageBurnHandler(contents); | 607 ImageBurnHandler* handler = new ImageBurnHandler(contents); |
615 AddMessageHandler((handler)->Attach(this)); | 608 AddMessageHandler((handler)->Attach(this)); |
616 ImageBurnUIHTMLSource* html_source = new ImageBurnUIHTMLSource(); | 609 ImageBurnUIHTMLSource* html_source = new ImageBurnUIHTMLSource(); |
617 BrowserThread::PostTask( | 610 BrowserThread::PostTask( |
618 BrowserThread::IO, FROM_HERE, | 611 BrowserThread::IO, FROM_HERE, |
619 NewRunnableMethod( | 612 NewRunnableMethod( |
620 Singleton<ChromeURLDataManager>::get(), | 613 Singleton<ChromeURLDataManager>::get(), |
621 &ChromeURLDataManager::AddDataSource, | 614 &ChromeURLDataManager::AddDataSource, |
622 make_scoped_refptr(html_source))); | 615 make_scoped_refptr(html_source))); |
623 } | 616 } |
OLD | NEW |