OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/components_ui.h" | 5 #include "chrome/browser/ui/webui/components_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_CHECKING); | 217 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_CHECKING); |
218 case update_client::CrxUpdateItem::State::kCanUpdate: | 218 case update_client::CrxUpdateItem::State::kCanUpdate: |
219 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATE); | 219 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATE); |
220 case update_client::CrxUpdateItem::State::kDownloadingDiff: | 220 case update_client::CrxUpdateItem::State::kDownloadingDiff: |
221 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DNL_DIFF); | 221 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DNL_DIFF); |
222 case update_client::CrxUpdateItem::State::kDownloading: | 222 case update_client::CrxUpdateItem::State::kDownloading: |
223 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DNL); | 223 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DNL); |
224 case update_client::CrxUpdateItem::State::kUpdatingDiff: | 224 case update_client::CrxUpdateItem::State::kUpdatingDiff: |
225 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDT_DIFF); | 225 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDT_DIFF); |
226 case update_client::CrxUpdateItem::State::kUpdating: | 226 case update_client::CrxUpdateItem::State::kUpdating: |
| 227 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATING); |
227 case update_client::CrxUpdateItem::State::kDownloaded: | 228 case update_client::CrxUpdateItem::State::kDownloaded: |
228 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATING); | 229 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DOWNLOADED); |
229 case update_client::CrxUpdateItem::State::kUpdated: | 230 case update_client::CrxUpdateItem::State::kUpdated: |
230 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATED); | 231 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATED); |
231 case update_client::CrxUpdateItem::State::kUpToDate: | 232 case update_client::CrxUpdateItem::State::kUpToDate: |
232 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPTODATE); | 233 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPTODATE); |
233 case update_client::CrxUpdateItem::State::kNoUpdate: | 234 case update_client::CrxUpdateItem::State::kNoUpdate: |
234 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NOUPDATE); | 235 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NOUPDATE); |
235 case update_client::CrxUpdateItem::State::kLastStatus: | 236 case update_client::CrxUpdateItem::State::kLastStatus: |
236 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); | 237 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); |
237 } | 238 } |
238 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); | 239 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); |
239 } | 240 } |
240 | 241 |
241 void ComponentsUI::OnEvent(Events event, const std::string& id) { | 242 void ComponentsUI::OnEvent(Events event, const std::string& id) { |
242 base::DictionaryValue parameters; | 243 base::DictionaryValue parameters; |
243 parameters.SetString("event", ComponentEventToString(event)); | 244 parameters.SetString("event", ComponentEventToString(event)); |
244 if (!id.empty()) { | 245 if (!id.empty()) { |
245 if (event == Events::COMPONENT_UPDATED) { | 246 if (event == Events::COMPONENT_UPDATED) { |
246 auto cus = g_browser_process->component_updater(); | 247 auto cus = g_browser_process->component_updater(); |
247 update_client::CrxUpdateItem item; | 248 update_client::CrxUpdateItem item; |
248 if (cus->GetComponentDetails(id, &item)) | 249 if (cus->GetComponentDetails(id, &item)) |
249 parameters.SetString("version", item.component.version.GetString()); | 250 parameters.SetString("version", item.component.version.GetString()); |
250 } | 251 } |
251 parameters.SetString("id", id); | 252 parameters.SetString("id", id); |
252 } | 253 } |
253 web_ui()->CallJavascriptFunction("onComponentEvent", parameters); | 254 web_ui()->CallJavascriptFunction("onComponentEvent", parameters); |
254 } | 255 } |
OLD | NEW |