Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: chrome/browser/ui/webui/extensions/chromeos/kiosk_apps_handler.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/bind.h" 16 #include "base/bind.h"
16 #include "base/command_line.h" 17 #include "base/command_line.h"
17 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
18 #include "base/sys_info.h" 19 #include "base/sys_info.h"
19 #include "base/values.h" 20 #include "base/values.h"
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h" 22 #include "chrome/browser/chromeos/settings/cros_settings.h"
22 #include "chrome/grit/chromium_strings.h" 23 #include "chrome/grit/chromium_strings.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 252
252 KioskAppManager::Apps apps; 253 KioskAppManager::Apps apps;
253 kiosk_app_manager_->GetApps(&apps); 254 kiosk_app_manager_->GetApps(&apps);
254 255
255 std::unique_ptr<base::ListValue> apps_list(new base::ListValue); 256 std::unique_ptr<base::ListValue> apps_list(new base::ListValue);
256 for (size_t i = 0; i < apps.size(); ++i) { 257 for (size_t i = 0; i < apps.size(); ++i) {
257 const KioskAppManager::App& app_data = apps[i]; 258 const KioskAppManager::App& app_data = apps[i];
258 259
259 std::unique_ptr<base::DictionaryValue> app_info(new base::DictionaryValue); 260 std::unique_ptr<base::DictionaryValue> app_info(new base::DictionaryValue);
260 PopulateAppDict(app_data, app_info.get()); 261 PopulateAppDict(app_data, app_info.get());
261 apps_list->Append(app_info.release()); 262 apps_list->Append(std::move(app_info));
262 } 263 }
263 settings.SetWithoutPathExpansion("apps", apps_list.release()); 264 settings.SetWithoutPathExpansion("apps", apps_list.release());
264 265
265 web_ui()->CallJavascriptFunctionUnsafe( 266 web_ui()->CallJavascriptFunctionUnsafe(
266 "extensions.KioskAppsOverlay.setSettings", settings); 267 "extensions.KioskAppsOverlay.setSettings", settings);
267 } 268 }
268 269
269 void KioskAppsHandler::HandleInitializeKioskAppSettings( 270 void KioskAppsHandler::HandleInitializeKioskAppSettings(
270 const base::ListValue* args) { 271 const base::ListValue* args) {
271 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus( 272 KioskAppManager::Get()->GetConsumerKioskAutoLaunchStatus(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 358
358 void KioskAppsHandler::ShowError(const std::string& app_id) { 359 void KioskAppsHandler::ShowError(const std::string& app_id) {
359 base::StringValue app_id_value(app_id); 360 base::StringValue app_id_value(app_id);
360 web_ui()->CallJavascriptFunctionUnsafe( 361 web_ui()->CallJavascriptFunctionUnsafe(
361 "extensions.KioskAppsOverlay.showError", app_id_value); 362 "extensions.KioskAppsOverlay.showError", app_id_value);
362 363
363 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_); 364 kiosk_app_manager_->RemoveApp(app_id, owner_settings_service_);
364 } 365 }
365 366
366 } // namespace chromeos 367 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/power_ui.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698