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

Side by Side Diff: chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc

Issue 7189076: Localize strings, speeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright dates Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/webui/chromeos/imageburner/imageburner_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h"
6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h" 6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h"
7 7
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/task.h" 10 #include "base/task.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/jstemplate_builder.h" 14 #include "chrome/common/jstemplate_builder.h"
15 #include "chrome/common/time_format.h" 15 #include "chrome/common/time_format.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "content/browser/browser_thread.h" 17 #include "content/browser/browser_thread.h"
18 #include "grit/browser_resources.h" 18 #include "grit/browser_resources.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/locale_settings.h" 20 #include "grit/locale_settings.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/base/text/bytes_formatting.h"
23 24
24 namespace imageburner { 25 namespace imageburner {
25 26
26 static const char kPropertyDevicePath[] = "devicePath"; 27 static const char kPropertyDevicePath[] = "devicePath";
27 static const char kPropertyFilePath[] = "filePath"; 28 static const char kPropertyFilePath[] = "filePath";
28 static const char kPropertyLabel[] = "label"; 29 static const char kPropertyLabel[] = "label";
29 static const char kPropertyPath[] = "path"; 30 static const char kPropertyPath[] = "path";
30 31
31 static const char kImageZipFileName[] = "chromeos_image.bin.zip"; 32 static const char kImageZipFileName[] = "chromeos_image.bin.zip";
32 33
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 if (time_left) { 590 if (time_left) {
590 string16 time_remaining_str = TimeFormat::TimeRemaining(*time_left); 591 string16 time_remaining_str = TimeFormat::TimeRemaining(*time_left);
591 *time_left_text = 592 *time_left_text =
592 l10n_util::GetStringFUTF16(message_id, time_remaining_str); 593 l10n_util::GetStringFUTF16(message_id, time_remaining_str);
593 } else { 594 } else {
594 *time_left_text = l10n_util::GetStringUTF16(message_id); 595 *time_left_text = l10n_util::GetStringUTF16(message_id);
595 } 596 }
596 } 597 }
597 598
598 void WebUIHandler::GetDataSizeText(int64 size, string16* size_text) { 599 void WebUIHandler::GetDataSizeText(int64 size, string16* size_text) {
599 DataUnits size_units = GetByteDisplayUnits(size); 600 *size_text = ui::FormatBytes(size);
600 *size_text = FormatBytes(size, size_units, true);
601 base::i18n::AdjustStringForLocaleDirection(size_text); 601 base::i18n::AdjustStringForLocaleDirection(size_text);
602 } 602 }
603 603
604 void WebUIHandler::GetProgressText(int message_id, 604 void WebUIHandler::GetProgressText(int message_id,
605 int64 amount_finished, int64 amount_total, string16* progress_text) { 605 int64 amount_finished, int64 amount_total, string16* progress_text) {
606 string16 finished; 606 string16 finished;
607 GetDataSizeText(amount_finished, &finished); 607 GetDataSizeText(amount_finished, &finished);
608 string16 total; 608 string16 total;
609 GetDataSizeText(amount_total, &total); 609 GetDataSizeText(amount_total, &total);
610 *progress_text = l10n_util::GetStringFUTF16(message_id, finished, total); 610 *progress_text = l10n_util::GetStringFUTF16(message_id, finished, total);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 // 645 //
646 //////////////////////////////////////////////////////////////////////////////// 646 ////////////////////////////////////////////////////////////////////////////////
647 647
648 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { 648 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) {
649 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); 649 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents);
650 AddMessageHandler((handler)->Attach(this)); 650 AddMessageHandler((handler)->Attach(this));
651 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource(); 651 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource();
652 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 652 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
653 } 653 }
654 654
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698