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

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

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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
« no previous file with comments | « chrome/utility/importer/firefox_importer.cc ('k') | chromeos/dbus/fake_easy_unlock_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chromeos/app_mode/kiosk_oem_manifest_parser.h" 5 #include "chromeos/app_mode/kiosk_oem_manifest_parser.h"
6 6
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 KioskOemManifestParser::Manifest::Manifest() 22 KioskOemManifestParser::Manifest::Manifest()
23 : enterprise_managed(false), 23 : enterprise_managed(false),
24 can_exit_enrollment(true), 24 can_exit_enrollment(true),
25 keyboard_driven_oobe(false) { 25 keyboard_driven_oobe(false) {
26 } 26 }
27 27
28 bool KioskOemManifestParser::Load( 28 bool KioskOemManifestParser::Load(
29 const base::FilePath& kiosk_oem_file, 29 const base::FilePath& kiosk_oem_file,
30 KioskOemManifestParser::Manifest* manifest) { 30 KioskOemManifestParser::Manifest* manifest) {
31 int error_code = JSONFileValueSerializer::JSON_NO_ERROR; 31 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR;
32 std::string error_msg; 32 std::string error_msg;
33 scoped_ptr<JSONFileValueSerializer> serializer( 33 scoped_ptr<JSONFileValueDeserializer> deserializer(
34 new JSONFileValueSerializer(kiosk_oem_file)); 34 new JSONFileValueDeserializer(kiosk_oem_file));
35 scoped_ptr<base::Value> value( 35 scoped_ptr<base::Value> value(
36 serializer->Deserialize(&error_code, &error_msg)); 36 deserializer->Deserialize(&error_code, &error_msg));
37 base::DictionaryValue* dict = NULL; 37 base::DictionaryValue* dict = NULL;
38 if (error_code != JSONFileValueSerializer::JSON_NO_ERROR || 38 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR ||
39 !value.get() || 39 !value.get() ||
40 !value->GetAsDictionary(&dict)) { 40 !value->GetAsDictionary(&dict)) {
41 return false; 41 return false;
42 } 42 }
43 43
44 dict->GetString(kDeviceRequisition, 44 dict->GetString(kDeviceRequisition,
45 &manifest->device_requisition); 45 &manifest->device_requisition);
46 dict->GetBoolean(kKeyboardDrivenOobe, 46 dict->GetBoolean(kKeyboardDrivenOobe,
47 &manifest->keyboard_driven_oobe); 47 &manifest->keyboard_driven_oobe);
48 if (!dict->GetBoolean(kEnterpriseManaged, 48 if (!dict->GetBoolean(kEnterpriseManaged,
49 &manifest->enterprise_managed) || 49 &manifest->enterprise_managed) ||
50 !dict->GetBoolean(kAllowReset, 50 !dict->GetBoolean(kAllowReset,
51 &manifest->can_exit_enrollment)) { 51 &manifest->can_exit_enrollment)) {
52 return false; 52 return false;
53 } 53 }
54 54
55 return true; 55 return true;
56 } 56 }
57 57
58 } // namespace chromeos 58 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/utility/importer/firefox_importer.cc ('k') | chromeos/dbus/fake_easy_unlock_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698