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

Side by Side Diff: trunk/src/chromeos/app_mode/kiosk_oem_manifest_parser.cc

Issue 14642018: Revert 197960 "[chromeos] Remove dependencies of StatisticsProvi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromeos/app_mode/kiosk_oem_manifest_parser.h"
6
7 #include "base/json/json_file_value_serializer.h"
8 #include "base/stringprintf.h"
9 #include "base/values.h"
10
11 namespace chromeos {
12
13 namespace {
14
15 const char kEnterpriseManaged[] = "enterprise_managed";
16 const char kAllowReset[] = "can_exit_enrollment";
17 const char kDeviceRequisition[] = "device_requisition";
18 const char kKeyboardDrivenOobe[] = "keyboard_driven_oobe";
19
20 } // namespace
21
22 KioskOemManifestParser::Manifest::Manifest()
23 : enterprise_managed(false),
24 can_exit_enrollment(true),
25 keyboard_driven_oobe(false) {
26 }
27
28 bool KioskOemManifestParser::Load(
29 const base::FilePath& kiosk_oem_file,
30 KioskOemManifestParser::Manifest* manifest) {
31 int error_code = JSONFileValueSerializer::JSON_NO_ERROR;
32 std::string error_msg;
33 scoped_ptr<JSONFileValueSerializer> serializer(
34 new JSONFileValueSerializer(kiosk_oem_file));
35 scoped_ptr<base::Value> value(
36 serializer->Deserialize(&error_code, &error_msg));
37 base::DictionaryValue* dict = NULL;
38 if (error_code != JSONFileValueSerializer::JSON_NO_ERROR ||
39 !value.get() ||
40 !value->GetAsDictionary(&dict)) {
41 return false;
42 }
43
44 dict->GetString(kDeviceRequisition,
45 &manifest->device_requisition);
46 dict->GetBoolean(kKeyboardDrivenOobe,
47 &manifest->keyboard_driven_oobe);
48 if (!dict->GetBoolean(kEnterpriseManaged,
49 &manifest->enterprise_managed) ||
50 !dict->GetBoolean(kAllowReset,
51 &manifest->can_exit_enrollment)) {
52 return false;
53 }
54
55 return true;
56 }
57
58 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698