OLD | NEW |
1 // Copyright (c) 2011 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" |
11 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
(...skipping 21 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 void UpdateScreenHandler::GetLocalizedStrings( | 35 void UpdateScreenHandler::GetLocalizedStrings( |
36 DictionaryValue *localized_strings) { | 36 DictionaryValue *localized_strings) { |
37 localized_strings->SetString("updateScreenTitle", | 37 localized_strings->SetString("updateScreenTitle", |
38 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE)); | 38 l10n_util::GetStringUTF16(IDS_UPDATE_SCREEN_TITLE)); |
39 localized_strings->SetString("checkingForUpdates", | 39 localized_strings->SetString("checkingForUpdates", |
40 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)); | 40 l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)); |
41 localized_strings->SetString("installingUpdateDesc", | 41 localized_strings->SetString("installingUpdateDesc", |
42 l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)); | 42 l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)); |
| 43 localized_strings->SetString("downloadingTimeLeftLong", |
| 44 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_LONG)); |
| 45 localized_strings->SetString("downloadingTimeLeftStatusOneHour", |
| 46 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR)); |
| 47 localized_strings->SetString("downloadingTimeLeftStatusMinutes", |
| 48 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES)); |
| 49 localized_strings->SetString("downloadingTimeLeftSmall", |
| 50 l10n_util::GetStringUTF16(IDS_DOWNLOADING_TIME_LEFT_SMALL)); |
43 #if !defined(OFFICIAL_BUILD) | 51 #if !defined(OFFICIAL_BUILD) |
44 localized_strings->SetString("cancelUpdateHint", | 52 localized_strings->SetString("cancelUpdateHint", |
45 l10n_util::GetStringUTF16(IDS_UPDATE_CANCEL)); | 53 l10n_util::GetStringUTF16(IDS_UPDATE_CANCEL)); |
46 localized_strings->SetString("cancelledUpdateMessage", | 54 localized_strings->SetString("cancelledUpdateMessage", |
47 l10n_util::GetStringUTF16(IDS_UPDATE_CANCELLED)); | 55 l10n_util::GetStringUTF16(IDS_UPDATE_CANCELLED)); |
48 #endif | 56 #endif |
49 } | 57 } |
50 | 58 |
51 void UpdateScreenHandler::Initialize() { | 59 void UpdateScreenHandler::Initialize() { |
52 if (show_on_init_) { | 60 if (show_on_init_) { |
(...skipping 27 matching lines...) Expand all Loading... |
80 StringValue message(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)); | 88 StringValue message(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)); |
81 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage", message); | 89 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateMessage", message); |
82 } | 90 } |
83 | 91 |
84 void UpdateScreenHandler::SetProgress(int progress) { | 92 void UpdateScreenHandler::SetProgress(int progress) { |
85 base::FundamentalValue progress_value(progress); | 93 base::FundamentalValue progress_value(progress); |
86 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress", | 94 web_ui()->CallJavascriptFunction("cr.ui.Oobe.setUpdateProgress", |
87 progress_value); | 95 progress_value); |
88 } | 96 } |
89 | 97 |
| 98 void UpdateScreenHandler::ShowEstimatedTimeLeft(bool enable) { |
| 99 base::FundamentalValue enable_value(enable); |
| 100 web_ui()->CallJavascriptFunction( |
| 101 "cr.ui.Oobe.showUpdateEstimatedTimeLeft", enable_value); |
| 102 } |
| 103 |
| 104 void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) { |
| 105 base::FundamentalValue seconds_value(time.InSecondsF()); |
| 106 web_ui()->CallJavascriptFunction( |
| 107 "cr.ui.Oobe.setUpdateEstimatedTimeLeft", seconds_value); |
| 108 } |
| 109 |
90 void UpdateScreenHandler::ShowCurtain(bool enable) { | 110 void UpdateScreenHandler::ShowCurtain(bool enable) { |
91 base::FundamentalValue enable_value(enable); | 111 base::FundamentalValue enable_value(enable); |
92 web_ui()->CallJavascriptFunction( | 112 web_ui()->CallJavascriptFunction( |
93 "cr.ui.Oobe.showUpdateCurtain", enable_value); | 113 "cr.ui.Oobe.showUpdateCurtain", enable_value); |
94 } | 114 } |
95 | 115 |
96 void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) { | 116 void UpdateScreenHandler::ShowPreparingUpdatesInfo(bool visible) { |
97 scoped_ptr<StringValue> info_message; | 117 scoped_ptr<StringValue> info_message; |
98 if (visible) { | 118 if (visible) { |
99 info_message.reset(Value::CreateStringValue( | 119 info_message.reset(Value::CreateStringValue( |
(...skipping 16 matching lines...) Expand all Loading... |
116 } | 136 } |
117 | 137 |
118 #if !defined(OFFICIAL_BUILD) | 138 #if !defined(OFFICIAL_BUILD) |
119 void UpdateScreenHandler::HandleUpdateCancel(const base::ListValue* args) { | 139 void UpdateScreenHandler::HandleUpdateCancel(const base::ListValue* args) { |
120 DCHECK(args && args->empty()); | 140 DCHECK(args && args->empty()); |
121 screen_->CancelUpdate(); | 141 screen_->CancelUpdate(); |
122 } | 142 } |
123 #endif | 143 #endif |
124 | 144 |
125 } // namespace chromeos | 145 } // namespace chromeos |
OLD | NEW |