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

Unified Diff: chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc

Issue 10389064: Added estimated time remaining on AU. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed license headers. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
index bf48bf10d9f12136a5ff2c12259181ec09fd98d5..f8c1190e4a00f78e71305ab040ad561799eb610b 100644
--- a/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/update_screen_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,6 +38,12 @@ void UpdateScreenHandler::GetLocalizedStrings(
l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE));
localized_strings->SetString("checkingForUpdates",
l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES));
+ localized_strings->SetString("updateStatsEstimating",
+ l10n_util::GetStringUTF16(IDS_UPDATE_STATS_ESTIMATING));
+ localized_strings->SetString("updateEstimatedTimeLeft",
+ l10n_util::GetStringUTF16(IDS_UPDATE_DOWNLOADING_ESTIMATED_TIME_LEFT));
+ localized_strings->SetString("updateDownloadingRate",
+ l10n_util::GetStringUTF16(IDS_UPDATE_DOWNLOADING_RATE));
localized_strings->SetString("installingUpdateDesc",
l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC));
#if !defined(OFFICIAL_BUILD)
@@ -87,12 +93,42 @@ void UpdateScreenHandler::SetProgress(int progress) {
progress_value);
}
+void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) {
+ int64 duration = time.InSeconds();
+
+ int seconds = duration % 60;
+ duration /= 60;
+ int minutes = duration % 60;
+ duration /= 60;
+ int hours = duration % 24;
+ duration /= 24;
+ int days = duration;
+
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateEstimatedTimeLeft",
+ base::FundamentalValue(days),
+ base::FundamentalValue(hours),
+ base::FundamentalValue(minutes),
+ base::FundamentalValue(seconds));
+}
+
+void UpdateScreenHandler::SetDownloadingRate(double rate) {
+ base::FundamentalValue rate_value(rate);
+ web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateDownloadingRate",
+ rate_value);
+}
+
void UpdateScreenHandler::ShowCurtain(bool enable) {
base::FundamentalValue enable_value(enable);
web_ui()->CallJavascriptFunction(
"cr.ui.Oobe.showUpdateCurtain", enable_value);
}
+void UpdateScreenHandler::ShowUpdateDownloadingStats(bool enable) {
+ base::FundamentalValue enable_value(enable);
+ web_ui()->CallJavascriptFunction(
+ "cr.ui.Oobe.showUpdateDownloadingStats", enable_value);
+}
+
void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) {
scoped_ptr<StringValue> info_message;
if (visible) {

Powered by Google App Engine
This is Rietveld 408576698