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 <set> | 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/bind.h" | 15 #include "base/bind.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
21 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
22 #include "chrome/grit/chromium_strings.h" | 22 #include "chrome/grit/chromium_strings.h" |
23 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
24 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
25 #include "chromeos/settings/cros_settings_names.h" | 25 #include "chromeos/settings/cros_settings_names.h" |
26 #include "components/crx_file/id_util.h" | 26 #include "components/crx_file/id_util.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 base::DictionaryValue settings; | 247 base::DictionaryValue settings; |
248 settings.SetBoolean("disableBailout", !enable_bailout_shortcut); | 248 settings.SetBoolean("disableBailout", !enable_bailout_shortcut); |
249 settings.SetBoolean("hasAutoLaunchApp", | 249 settings.SetBoolean("hasAutoLaunchApp", |
250 !kiosk_app_manager_->GetAutoLaunchApp().empty()); | 250 !kiosk_app_manager_->GetAutoLaunchApp().empty()); |
251 | 251 |
252 KioskAppManager::Apps apps; | 252 KioskAppManager::Apps apps; |
253 kiosk_app_manager_->GetApps(&apps); | 253 kiosk_app_manager_->GetApps(&apps); |
254 | 254 |
255 scoped_ptr<base::ListValue> apps_list(new base::ListValue); | 255 std::unique_ptr<base::ListValue> apps_list(new base::ListValue); |
256 for (size_t i = 0; i < apps.size(); ++i) { | 256 for (size_t i = 0; i < apps.size(); ++i) { |
257 const KioskAppManager::App& app_data = apps[i]; | 257 const KioskAppManager::App& app_data = apps[i]; |
258 | 258 |
259 scoped_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); | 259 std::unique_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); |
260 PopulateAppDict(app_data, app_info.get()); | 260 PopulateAppDict(app_data, app_info.get()); |
261 apps_list->Append(app_info.release()); | 261 apps_list->Append(app_info.release()); |
262 } | 262 } |
263 settings.SetWithoutPathExpansion("apps", apps_list.release()); | 263 settings.SetWithoutPathExpansion("apps", apps_list.release()); |
264 | 264 |
265 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.setSettings", | 265 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.setSettings", |
266 settings); | 266 settings); |
267 } | 267 } |
268 | 268 |
269 void KioskAppsHandler::HandleInitializeKioskAppSettings( | 269 void KioskAppsHandler::HandleInitializeKioskAppSettings( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 void KioskAppsHandler::ShowError(const std::string& app_id) { | 358 void KioskAppsHandler::ShowError(const std::string& app_id) { |
359 base::StringValue app_id_value(app_id); | 359 base::StringValue app_id_value(app_id); |
360 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", | 360 web_ui()->CallJavascriptFunction("extensions.KioskAppsOverlay.showError", |
361 app_id_value); | 361 app_id_value); |
362 | 362 |
363 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); | 363 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); |
364 } | 364 } |
365 | 365 |
366 } // namespace chromeos | 366 } // namespace chromeos |
OLD | NEW |