| 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 <memory> | 10 #include <memory> |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 component_updater::ComponentUpdateService* cus = | 152 component_updater::ComponentUpdateService* cus = |
| 153 g_browser_process->component_updater(); | 153 g_browser_process->component_updater(); |
| 154 if (cus) | 154 if (cus) |
| 155 cus->RemoveObserver(this); | 155 cus->RemoveObserver(this); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // static | 158 // static |
| 159 void ComponentsUI::OnDemandUpdate(const std::string& component_id) { | 159 void ComponentsUI::OnDemandUpdate(const std::string& component_id) { |
| 160 component_updater::ComponentUpdateService* cus = | 160 component_updater::ComponentUpdateService* cus = |
| 161 g_browser_process->component_updater(); | 161 g_browser_process->component_updater(); |
| 162 cus->GetOnDemandUpdater().OnDemandUpdate(component_id); | 162 cus->GetOnDemandUpdater().OnDemandUpdate( |
| 163 component_id, |
| 164 component_updater::ComponentUpdateService::CompletionCallback()); |
| 163 } | 165 } |
| 164 | 166 |
| 165 // static | 167 // static |
| 166 base::ListValue* ComponentsUI::LoadComponents() { | 168 base::ListValue* ComponentsUI::LoadComponents() { |
| 167 component_updater::ComponentUpdateService* cus = | 169 component_updater::ComponentUpdateService* cus = |
| 168 g_browser_process->component_updater(); | 170 g_browser_process->component_updater(); |
| 169 std::vector<std::string> component_ids; | 171 std::vector<std::string> component_ids; |
| 170 component_ids = cus->GetComponentIDs(); | 172 component_ids = cus->GetComponentIDs(); |
| 171 | 173 |
| 172 // Construct DictionaryValues to return to UI. | 174 // Construct DictionaryValues to return to UI. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (event == Events::COMPONENT_UPDATED) { | 256 if (event == Events::COMPONENT_UPDATED) { |
| 255 auto* component_updater = g_browser_process->component_updater(); | 257 auto* component_updater = g_browser_process->component_updater(); |
| 256 update_client::CrxUpdateItem item; | 258 update_client::CrxUpdateItem item; |
| 257 if (component_updater->GetComponentDetails(id, &item)) | 259 if (component_updater->GetComponentDetails(id, &item)) |
| 258 parameters.SetString("version", item.component.version.GetString()); | 260 parameters.SetString("version", item.component.version.GetString()); |
| 259 } | 261 } |
| 260 parameters.SetString("id", id); | 262 parameters.SetString("id", id); |
| 261 } | 263 } |
| 262 web_ui()->CallJavascriptFunctionUnsafe("onComponentEvent", parameters); | 264 web_ui()->CallJavascriptFunctionUnsafe("onComponentEvent", parameters); |
| 263 } | 265 } |
| OLD | NEW |