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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 case update_client::CrxUpdateItem::State::kUpdating: | 230 case update_client::CrxUpdateItem::State::kUpdating: |
231 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATING); | 231 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATING); |
232 case update_client::CrxUpdateItem::State::kDownloaded: | 232 case update_client::CrxUpdateItem::State::kDownloaded: |
233 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DOWNLOADED); | 233 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_DOWNLOADED); |
234 case update_client::CrxUpdateItem::State::kUpdated: | 234 case update_client::CrxUpdateItem::State::kUpdated: |
235 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATED); | 235 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPDATED); |
236 case update_client::CrxUpdateItem::State::kUpToDate: | 236 case update_client::CrxUpdateItem::State::kUpToDate: |
237 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPTODATE); | 237 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_UPTODATE); |
238 case update_client::CrxUpdateItem::State::kNoUpdate: | 238 case update_client::CrxUpdateItem::State::kNoUpdate: |
239 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NOUPDATE); | 239 return l10n_util::GetStringUTF16(IDS_COMPONENTS_SVC_STATUS_NOUPDATE); |
| 240 case update_client::CrxUpdateItem::State::kUninstalled: // Fall through. |
240 case update_client::CrxUpdateItem::State::kLastStatus: | 241 case update_client::CrxUpdateItem::State::kLastStatus: |
241 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); | 242 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); |
242 } | 243 } |
243 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); | 244 return l10n_util::GetStringUTF16(IDS_COMPONENTS_UNKNOWN); |
244 } | 245 } |
245 | 246 |
246 void ComponentsUI::OnEvent(Events event, const std::string& id) { | 247 void ComponentsUI::OnEvent(Events event, const std::string& id) { |
247 base::DictionaryValue parameters; | 248 base::DictionaryValue parameters; |
248 parameters.SetString("event", ComponentEventToString(event)); | 249 parameters.SetString("event", ComponentEventToString(event)); |
249 if (!id.empty()) { | 250 if (!id.empty()) { |
250 if (event == Events::COMPONENT_UPDATED) { | 251 if (event == Events::COMPONENT_UPDATED) { |
251 auto cus = g_browser_process->component_updater(); | 252 auto cus = g_browser_process->component_updater(); |
252 update_client::CrxUpdateItem item; | 253 update_client::CrxUpdateItem item; |
253 if (cus->GetComponentDetails(id, &item)) | 254 if (cus->GetComponentDetails(id, &item)) |
254 parameters.SetString("version", item.component.version.GetString()); | 255 parameters.SetString("version", item.component.version.GetString()); |
255 } | 256 } |
256 parameters.SetString("id", id); | 257 parameters.SetString("id", id); |
257 } | 258 } |
258 web_ui()->CallJavascriptFunction("onComponentEvent", parameters); | 259 web_ui()->CallJavascriptFunction("onComponentEvent", parameters); |
259 } | 260 } |
OLD | NEW |