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/extensions/chromeos/kiosk_apps_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 kiosk_app_manager_->GetApps(&apps); | 266 kiosk_app_manager_->GetApps(&apps); |
267 | 267 |
268 std::unique_ptr<base::ListValue> apps_list(new base::ListValue); | 268 std::unique_ptr<base::ListValue> apps_list(new base::ListValue); |
269 for (size_t i = 0; i < apps.size(); ++i) { | 269 for (size_t i = 0; i < apps.size(); ++i) { |
270 const KioskAppManager::App& app_data = apps[i]; | 270 const KioskAppManager::App& app_data = apps[i]; |
271 | 271 |
272 std::unique_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); | 272 std::unique_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); |
273 PopulateAppDict(app_data, app_info.get()); | 273 PopulateAppDict(app_data, app_info.get()); |
274 apps_list->Append(std::move(app_info)); | 274 apps_list->Append(std::move(app_info)); |
275 } | 275 } |
276 settings.SetWithoutPathExpansion("apps", apps_list.release()); | 276 settings.SetWithoutPathExpansion("apps", std::move(apps_list)); |
277 | 277 |
278 web_ui()->CallJavascriptFunctionUnsafe( | 278 web_ui()->CallJavascriptFunctionUnsafe( |
279 "extensions.KioskAppsOverlay.setSettings", settings); | 279 "extensions.KioskAppsOverlay.setSettings", settings); |
280 } | 280 } |
281 | 281 |
282 void KioskAppsHandler::HandleInitializeKioskAppSettings( | 282 void KioskAppsHandler::HandleInitializeKioskAppSettings( |
283 const base::ListValue* args) { | 283 const base::ListValue* args) { |
284 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( | 284 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( |
285 base::Bind(&KioskAppsHandler::OnGetConsumerKioskAutoLaunchStatus, | 285 base::Bind(&KioskAppsHandler::OnGetConsumerKioskAutoLaunchStatus, |
286 weak_ptr_factory_.GetWeakPtr())); | 286 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 void KioskAppsHandler::ShowError(const std::string& app_id) { | 371 void KioskAppsHandler::ShowError(const std::string& app_id) { |
372 base::Value app_id_value(app_id); | 372 base::Value app_id_value(app_id); |
373 web_ui()->CallJavascriptFunctionUnsafe( | 373 web_ui()->CallJavascriptFunctionUnsafe( |
374 "extensions.KioskAppsOverlay.showError", app_id_value); | 374 "extensions.KioskAppsOverlay.showError", app_id_value); |
375 | 375 |
376 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); | 376 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); |
377 } | 377 } |
378 | 378 |
379 } // namespace chromeos | 379 } // namespace chromeos |
OLD | NEW |