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

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

Issue 7189076: Localize strings, speeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweaking 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_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/imageburner_ui.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/download/download_types.h" 14 #include "chrome/browser/download/download_types.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/jstemplate_builder.h" 17 #include "chrome/common/jstemplate_builder.h"
18 #include "chrome/common/time_format.h" 18 #include "chrome/common/time_format.h"
19 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
20 #include "content/browser/browser_thread.h" 20 #include "content/browser/browser_thread.h"
21 #include "grit/browser_resources.h" 21 #include "grit/browser_resources.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/locale_settings.h" 23 #include "grit/locale_settings.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/base/text/bytes_formatting.h"
26 27
27 static const char kPropertyDevicePath[] = "devicePath"; 28 static const char kPropertyDevicePath[] = "devicePath";
28 static const char kPropertyFilePath[] = "filePath"; 29 static const char kPropertyFilePath[] = "filePath";
29 static const char kPropertyLabel[] = "label"; 30 static const char kPropertyLabel[] = "label";
30 static const char kPropertyPath[] = "path"; 31 static const char kPropertyPath[] = "path";
31 32
32 static const char kConfigFileUrl[] = 33 static const char kConfigFileUrl[] =
33 "https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf"; 34 "https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf";
34 static const char kImageZipFileName[] = "chromeos_image.bin.zip"; 35 static const char kImageZipFileName[] = "chromeos_image.bin.zip";
35 static const char kTempImageFolderName[] = "chromeos_image"; 36 static const char kTempImageFolderName[] = "chromeos_image";
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 if (time_left) { 606 if (time_left) {
606 string16 time_remaining_str = TimeFormat::TimeRemaining(*time_left); 607 string16 time_remaining_str = TimeFormat::TimeRemaining(*time_left);
607 *time_left_text = 608 *time_left_text =
608 l10n_util::GetStringFUTF16(message_id, time_remaining_str); 609 l10n_util::GetStringFUTF16(message_id, time_remaining_str);
609 } else { 610 } else {
610 *time_left_text = l10n_util::GetStringUTF16(message_id); 611 *time_left_text = l10n_util::GetStringUTF16(message_id);
611 } 612 }
612 } 613 }
613 614
614 void ImageBurnHandler::GetDataSizeText(int64 size, string16* size_text) { 615 void ImageBurnHandler::GetDataSizeText(int64 size, string16* size_text) {
615 DataUnits size_units = GetByteDisplayUnits(size); 616 *size_text = ui::FormatBytes(size, ui::DATA_UNITS_NATURAL, true);
616 *size_text = FormatBytes(size, size_units, true);
617 base::i18n::AdjustStringForLocaleDirection(size_text); 617 base::i18n::AdjustStringForLocaleDirection(size_text);
618 } 618 }
619 619
620 void ImageBurnHandler::GetProgressText(int message_id, 620 void ImageBurnHandler::GetProgressText(int message_id,
621 int64 amount_finished, int64 amount_total, string16* progress_text) { 621 int64 amount_finished, int64 amount_total, string16* progress_text) {
622 string16 finished; 622 string16 finished;
623 GetDataSizeText(amount_finished, &finished); 623 GetDataSizeText(amount_finished, &finished);
624 string16 total; 624 string16 total;
625 GetDataSizeText(amount_total, &total); 625 GetDataSizeText(amount_total, &total);
626 *progress_text = l10n_util::GetStringFUTF16(message_id, finished, total); 626 *progress_text = l10n_util::GetStringFUTF16(message_id, finished, total);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 // 1045 //
1046 // ImageBurnUI 1046 // ImageBurnUI
1047 // 1047 //
1048 //////////////////////////////////////////////////////////////////////////////// 1048 ////////////////////////////////////////////////////////////////////////////////
1049 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { 1049 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) {
1050 ImageBurnHandler* handler = new ImageBurnHandler(contents); 1050 ImageBurnHandler* handler = new ImageBurnHandler(contents);
1051 AddMessageHandler((handler)->Attach(this)); 1051 AddMessageHandler((handler)->Attach(this));
1052 ImageBurnUIHTMLSource* html_source = new ImageBurnUIHTMLSource(); 1052 ImageBurnUIHTMLSource* html_source = new ImageBurnUIHTMLSource();
1053 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); 1053 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
1054 } 1054 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698