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

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

Issue 10882014: Slightly modified ETA computation algorithm. Also modified UI of the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/login/update_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 27 matching lines...) Expand all
38 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME); 38 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME);
39 localized_strings->SetString("checkingForUpdatesMsg", 39 localized_strings->SetString("checkingForUpdatesMsg",
40 l10n_util::GetStringFUTF16(IDS_CHECKING_FOR_UPDATE_MSG, 40 l10n_util::GetStringFUTF16(IDS_CHECKING_FOR_UPDATE_MSG,
41 short_product_name)); 41 short_product_name));
42 localized_strings->SetString("updateScreenTitle", 42 localized_strings->SetString("updateScreenTitle",
43 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE)); 43 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE));
44 localized_strings->SetString("checkingForUpdates", 44 localized_strings->SetString("checkingForUpdates",
45 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)); 45 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES));
46 localized_strings->SetString("installingUpdateDesc", 46 localized_strings->SetString("installingUpdateDesc",
47 l10n_util::GetStringFUTF16(IDS_UPDATE_MSG, short_product_name)); 47 l10n_util::GetStringFUTF16(IDS_UPDATE_MSG, short_product_name));
48 localized_strings->SetString("downloading",
49 l10n_util::GetStringUTF16(IDS_DOWNLOADING));
48 localized_strings->SetString("downloadingTimeLeftLong", 50 localized_strings->SetString("downloadingTimeLeftLong",
49 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_LONG)); 51 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_LONG));
50 localized_strings->SetString("downloadingTimeLeftStatusOneHour", 52 localized_strings->SetString("downloadingTimeLeftStatusOneHour",
51 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR)); 53 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR));
52 localized_strings->SetString("downloadingTimeLeftStatusMinutes", 54 localized_strings->SetString("downloadingTimeLeftStatusMinutes",
53 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES)); 55 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES));
54 localized_strings->SetString("downloadingTimeLeftSmall", 56 localized_strings->SetString("downloadingTimeLeftSmall",
55 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_SMALL)); 57 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_SMALL));
56 #if !defined(OFFICIAL_BUILD) 58 #if !defined(OFFICIAL_BUILD)
57 localized_strings->SetString("cancelUpdateHint", 59 localized_strings->SetString("cancelUpdateHint",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 98
97 void UpdateScreenHandler::SetProgress(int progress) { 99 void UpdateScreenHandler::SetProgress(int progress) {
98 base::FundamentalValue progress_value(progress); 100 base::FundamentalValue progress_value(progress);
99 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress", 101 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress",
100 progress_value); 102 progress_value);
101 } 103 }
102 104
103 void UpdateScreenHandler::ShowEstimatedTimeLeft(bool enable) { 105 void UpdateScreenHandler::ShowEstimatedTimeLeft(bool enable) {
104 base::FundamentalValue enable_value(enable); 106 base::FundamentalValue enable_value(enable);
105 web_ui()->CallJavascriptFunction( 107 web_ui()->CallJavascriptFunction(
106 "cr.ui.Oobe.showUpdateEstimatedTimeLeft", enable_value); 108 "cr.ui.Oobe.showEstimatedTimeLeft", enable_value);
107 } 109 }
108 110
109 void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) { 111 void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) {
110 base::FundamentalValue seconds_value(time.InSecondsF()); 112 base::FundamentalValue seconds_value(time.InSecondsF());
111 web_ui()->CallJavascriptFunction( 113 web_ui()->CallJavascriptFunction(
112 "cr.ui.Oobe.setUpdateEstimatedTimeLeft", seconds_value); 114 "cr.ui.Oobe.setEstimatedTimeLeft", seconds_value);
115 }
116
117 void UpdateScreenHandler::ShowProgressMessage(bool enable) {
118 base::FundamentalValue enable_value(enable);
119 web_ui()->CallJavascriptFunction(
120 "cr.ui.Oobe.showProgressMessage", enable_value);
121 }
122
123 void UpdateScreenHandler::SetProgressMessage(ProgressMessage message) {
124 scoped_ptr<StringValue> progress_message;
125 switch (message) {
126 case PROGRESS_MESSAGE_UPDATE_AVAILABLE:
127 progress_message.reset(Value::CreateStringValue(
128 l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE)));
129 break;
130 case PROGRESS_MESSAGE_INSTALLING_UPDATE:
131 progress_message.reset(Value::CreateStringValue(
132 l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE,
133 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))));
134 break;
135 case PROGRESS_MESSAGE_VERIFYING:
136 progress_message.reset(Value::CreateStringValue(
137 l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING)));
138 break;
139 case PROGRESS_MESSAGE_FINALIZING:
140 progress_message.reset(Value::CreateStringValue(
141 l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING)));
142 break;
143 default:
144 NOTREACHED();
145 };
146 if (progress_message.get()) {
147 web_ui()->CallJavascriptFunction(
148 "cr.ui.Oobe.setProgressMessage", *progress_message);
149 }
113 } 150 }
114 151
115 void UpdateScreenHandler::ShowCurtain(bool enable) { 152 void UpdateScreenHandler::ShowCurtain(bool enable) {
116 base::FundamentalValue enable_value(enable); 153 base::FundamentalValue enable_value(enable);
117 web_ui()->CallJavascriptFunction( 154 web_ui()->CallJavascriptFunction(
118 "cr.ui.Oobe.showUpdateCurtain", enable_value); 155 "cr.ui.Oobe.showUpdateCurtain", enable_value);
119 } 156 }
120 157
121 void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) {
122 scoped_ptr<StringValue> info_message;
123 if (visible) {
124 info_message.reset(Value::CreateStringValue(
125 l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE)));
126 } else {
127 info_message.reset(Value::CreateStringValue(
128 l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE,
129 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))));
130 }
131 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage",
132 *info_message);
133 }
134
135 void UpdateScreenHandler::RegisterMessages() { 158 void UpdateScreenHandler::RegisterMessages() {
136 #if !defined(OFFICIAL_BUILD) 159 #if !defined(OFFICIAL_BUILD)
137 web_ui()->RegisterMessageCallback("cancelUpdate", 160 web_ui()->RegisterMessageCallback("cancelUpdate",
138 base::Bind(&UpdateScreenHandler::HandleUpdateCancel, 161 base::Bind(&UpdateScreenHandler::HandleUpdateCancel,
139 base::Unretained(this))); 162 base::Unretained(this)));
140 #endif 163 #endif
141 } 164 }
142 165
143 #if !defined(OFFICIAL_BUILD) 166 #if !defined(OFFICIAL_BUILD)
144 void UpdateScreenHandler::HandleUpdateCancel(const base::ListValue* args) { 167 void UpdateScreenHandler::HandleUpdateCancel(const base::ListValue* args) {
145 DCHECK(args && args->empty()); 168 DCHECK(args && args->empty());
146 screen_->CancelUpdate(); 169 screen_->CancelUpdate();
147 } 170 }
148 #endif 171 #endif
149 172
150 } // namespace chromeos 173 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698