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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 "checkUpdate", | 98 "checkUpdate", |
99 base::Bind(&ComponentsDOMHandler::HandleCheckUpdate, | 99 base::Bind(&ComponentsDOMHandler::HandleCheckUpdate, |
100 base::Unretained(this))); | 100 base::Unretained(this))); |
101 } | 101 } |
102 | 102 |
103 void ComponentsDOMHandler::HandleRequestComponentsData( | 103 void ComponentsDOMHandler::HandleRequestComponentsData( |
104 const base::ListValue* args) { | 104 const base::ListValue* args) { |
105 base::ListValue* list = ComponentsUI::LoadComponents(); | 105 base::ListValue* list = ComponentsUI::LoadComponents(); |
106 base::DictionaryValue result; | 106 base::DictionaryValue result; |
107 result.Set("components", list); | 107 result.Set("components", list); |
108 web_ui()->CallJavascriptFunction("returnComponentsData", result); | 108 web_ui()->CallJavascriptFunctionUnsafe("returnComponentsData", result); |
109 } | 109 } |
110 | 110 |
111 // This function is called when user presses button from html UI. | 111 // This function is called when user presses button from html UI. |
112 // TODO(shrikant): We need to make this button available based on current | 112 // TODO(shrikant): We need to make this button available based on current |
113 // state e.g. If component state is currently updating then we need to disable | 113 // state e.g. If component state is currently updating then we need to disable |
114 // button. (https://code.google.com/p/chromium/issues/detail?id=272540) | 114 // button. (https://code.google.com/p/chromium/issues/detail?id=272540) |
115 void ComponentsDOMHandler::HandleCheckUpdate(const base::ListValue* args) { | 115 void ComponentsDOMHandler::HandleCheckUpdate(const base::ListValue* args) { |
116 if (args->GetSize() != 1) { | 116 if (args->GetSize() != 1) { |
117 NOTREACHED(); | 117 NOTREACHED(); |
118 return; | 118 return; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 parameters.SetString("event", ComponentEventToString(event)); | 249 parameters.SetString("event", ComponentEventToString(event)); |
250 if (!id.empty()) { | 250 if (!id.empty()) { |
251 if (event == Events::COMPONENT_UPDATED) { | 251 if (event == Events::COMPONENT_UPDATED) { |
252 auto cus = g_browser_process->component_updater(); | 252 auto cus = g_browser_process->component_updater(); |
253 update_client::CrxUpdateItem item; | 253 update_client::CrxUpdateItem item; |
254 if (cus->GetComponentDetails(id, &item)) | 254 if (cus->GetComponentDetails(id, &item)) |
255 parameters.SetString("version", item.component.version.GetString()); | 255 parameters.SetString("version", item.component.version.GetString()); |
256 } | 256 } |
257 parameters.SetString("id", id); | 257 parameters.SetString("id", id); |
258 } | 258 } |
259 web_ui()->CallJavascriptFunction("onComponentEvent", parameters); | 259 web_ui()->CallJavascriptFunctionUnsafe("onComponentEvent", parameters); |
260 } | 260 } |
OLD | NEW |