| OLD | NEW |
| 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/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 9 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 10 #include "grit/chromium_strings.h" | 10 #include "grit/chromium_strings.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 show_on_init_(false) { | 25 show_on_init_(false) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 UpdateScreenHandler::~UpdateScreenHandler() { | 28 UpdateScreenHandler::~UpdateScreenHandler() { |
| 29 if (screen_) | 29 if (screen_) |
| 30 screen_->OnActorDestroyed(this); | 30 screen_->OnActorDestroyed(this); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void UpdateScreenHandler::DeclareLocalizedValues( | 33 void UpdateScreenHandler::DeclareLocalizedValues( |
| 34 LocalizedValuesBuilder* builder) { | 34 LocalizedValuesBuilder* builder) { |
| 35 builder->AddF("checkingForUpdatesMsg", | 35 builder->Add("checkingForUpdatesMsg", IDS_CHECKING_FOR_UPDATE_MSG); |
| 36 IDS_CHECKING_FOR_UPDATE_MSG, IDS_SHORT_PRODUCT_NAME); | 36 builder->Add("installingUpdateDesc", IDS_UPDATE_MSG); |
| 37 builder->AddF("installingUpdateDesc", | |
| 38 IDS_UPDATE_MSG, IDS_SHORT_PRODUCT_NAME); | |
| 39 | |
| 40 builder->Add("updateScreenTitle", IDS_UPDATE_SCREEN_TITLE); | 37 builder->Add("updateScreenTitle", IDS_UPDATE_SCREEN_TITLE); |
| 41 builder->Add("updateScreenAccessibleTitle", | 38 builder->Add("updateScreenAccessibleTitle", |
| 42 IDS_UPDATE_SCREEN_ACCESSIBLE_TITLE); | 39 IDS_UPDATE_SCREEN_ACCESSIBLE_TITLE); |
| 43 builder->Add("checkingForUpdates", IDS_CHECKING_FOR_UPDATES); | 40 builder->Add("checkingForUpdates", IDS_CHECKING_FOR_UPDATES); |
| 44 builder->Add("downloading", IDS_DOWNLOADING); | 41 builder->Add("downloading", IDS_DOWNLOADING); |
| 45 builder->Add("downloadingTimeLeftLong", IDS_DOWNLOADING_TIME_LEFT_LONG); | 42 builder->Add("downloadingTimeLeftLong", IDS_DOWNLOADING_TIME_LEFT_LONG); |
| 46 builder->Add("downloadingTimeLeftStatusOneHour", | 43 builder->Add("downloadingTimeLeftStatusOneHour", |
| 47 IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR); | 44 IDS_DOWNLOADING_TIME_LEFT_STATUS_ONE_HOUR); |
| 48 builder->Add("downloadingTimeLeftStatusMinutes", | 45 builder->Add("downloadingTimeLeftStatusMinutes", |
| 49 IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES); | 46 IDS_DOWNLOADING_TIME_LEFT_STATUS_MINUTES); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 97 |
| 101 void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) { | 98 void UpdateScreenHandler::SetEstimatedTimeLeft(const base::TimeDelta& time) { |
| 102 CallJS("setEstimatedTimeLeft", time.InSecondsF()); | 99 CallJS("setEstimatedTimeLeft", time.InSecondsF()); |
| 103 } | 100 } |
| 104 | 101 |
| 105 void UpdateScreenHandler::ShowProgressMessage(bool visible) { | 102 void UpdateScreenHandler::ShowProgressMessage(bool visible) { |
| 106 CallJS("showProgressMessage", visible); | 103 CallJS("showProgressMessage", visible); |
| 107 } | 104 } |
| 108 | 105 |
| 109 void UpdateScreenHandler::SetProgressMessage(ProgressMessage message) { | 106 void UpdateScreenHandler::SetProgressMessage(ProgressMessage message) { |
| 110 scoped_ptr<base::StringValue> progress_message; | 107 int ids = 0; |
| 111 switch (message) { | 108 switch (message) { |
| 112 case PROGRESS_MESSAGE_UPDATE_AVAILABLE: | 109 case PROGRESS_MESSAGE_UPDATE_AVAILABLE: |
| 113 progress_message.reset(base::Value::CreateStringValue( | 110 ids = IDS_UPDATE_AVAILABLE; |
| 114 l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE))); | |
| 115 break; | 111 break; |
| 116 case PROGRESS_MESSAGE_INSTALLING_UPDATE: | 112 case PROGRESS_MESSAGE_INSTALLING_UPDATE: |
| 117 progress_message.reset(base::Value::CreateStringValue( | 113 ids = IDS_INSTALLING_UPDATE; |
| 118 l10n_util::GetStringFUTF16(IDS_INSTALLING_UPDATE, | |
| 119 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)))); | |
| 120 break; | 114 break; |
| 121 case PROGRESS_MESSAGE_VERIFYING: | 115 case PROGRESS_MESSAGE_VERIFYING: |
| 122 progress_message.reset(base::Value::CreateStringValue( | 116 ids = IDS_UPDATE_VERIFYING; |
| 123 l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING))); | |
| 124 break; | 117 break; |
| 125 case PROGRESS_MESSAGE_FINALIZING: | 118 case PROGRESS_MESSAGE_FINALIZING: |
| 126 progress_message.reset(base::Value::CreateStringValue( | 119 ids = IDS_UPDATE_FINALIZING; |
| 127 l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING))); | |
| 128 break; | 120 break; |
| 129 default: | 121 default: |
| 130 NOTREACHED(); | 122 NOTREACHED(); |
| 131 }; | 123 return; |
| 132 if (progress_message.get()) | 124 } |
| 133 CallJS("setProgressMessage", *progress_message); | 125 |
| 126 CallJS("setProgressMessage", l10n_util::GetStringUTF16(ids)); |
| 134 } | 127 } |
| 135 | 128 |
| 136 void UpdateScreenHandler::ShowCurtain(bool visible) { | 129 void UpdateScreenHandler::ShowCurtain(bool visible) { |
| 137 CallJS("showUpdateCurtain", visible); | 130 CallJS("showUpdateCurtain", visible); |
| 138 } | 131 } |
| 139 | 132 |
| 140 void UpdateScreenHandler::RegisterMessages() { | 133 void UpdateScreenHandler::RegisterMessages() { |
| 141 #if !defined(OFFICIAL_BUILD) | 134 #if !defined(OFFICIAL_BUILD) |
| 142 AddCallback("cancelUpdate", &UpdateScreenHandler::HandleUpdateCancel); | 135 AddCallback("cancelUpdate", &UpdateScreenHandler::HandleUpdateCancel); |
| 143 #endif | 136 #endif |
| 144 } | 137 } |
| 145 | 138 |
| 146 void UpdateScreenHandler::OnConnectToNetworkRequested( | 139 void UpdateScreenHandler::OnConnectToNetworkRequested( |
| 147 const std::string& service_path) { | 140 const std::string& service_path) { |
| 148 if (screen_) | 141 if (screen_) |
| 149 screen_->OnConnectToNetworkRequested(service_path); | 142 screen_->OnConnectToNetworkRequested(service_path); |
| 150 } | 143 } |
| 151 | 144 |
| 152 #if !defined(OFFICIAL_BUILD) | 145 #if !defined(OFFICIAL_BUILD) |
| 153 void UpdateScreenHandler::HandleUpdateCancel() { | 146 void UpdateScreenHandler::HandleUpdateCancel() { |
| 154 screen_->CancelUpdate(); | 147 screen_->CancelUpdate(); |
| 155 } | 148 } |
| 156 #endif | 149 #endif |
| 157 | 150 |
| 158 } // namespace chromeos | 151 } // namespace chromeos |
| OLD | NEW |