OLD | NEW |
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 "chrome/browser/chromeos/extensions/default_app_order.h" | 5 #include "chrome/browser/chromeos/extensions/default_app_order.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop | 56 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop |
57 }; | 57 }; |
58 | 58 |
59 // Reads external ordinal json file and returned the parsed value. Returns NULL | 59 // Reads external ordinal json file and returned the parsed value. Returns NULL |
60 // if the file does not exist or could not be parsed properly. Caller takes | 60 // if the file does not exist or could not be parsed properly. Caller takes |
61 // ownership of the returned value. | 61 // ownership of the returned value. |
62 base::ListValue* ReadExternalOrdinalFile(const base::FilePath& path) { | 62 base::ListValue* ReadExternalOrdinalFile(const base::FilePath& path) { |
63 if (!base::PathExists(path)) | 63 if (!base::PathExists(path)) |
64 return NULL; | 64 return NULL; |
65 | 65 |
66 JSONFileValueSerializer serializer(path); | 66 JSONFileValueDeserializer deserializer(path); |
67 std::string error_msg; | 67 std::string error_msg; |
68 base::Value* value = serializer.Deserialize(NULL, &error_msg); | 68 base::Value* value = deserializer.Deserialize(NULL, &error_msg); |
69 if (!value) { | 69 if (!value) { |
70 LOG(WARNING) << "Unable to deserialize default app ordinals json data:" | 70 LOG(WARNING) << "Unable to deserialize default app ordinals json data:" |
71 << error_msg << ", file=" << path.value(); | 71 << error_msg << ", file=" << path.value(); |
72 return NULL; | 72 return NULL; |
73 } | 73 } |
74 | 74 |
75 base::ListValue* ordinal_list_value = NULL; | 75 base::ListValue* ordinal_list_value = NULL; |
76 if (value->GetAsList(&ordinal_list_value)) | 76 if (value->GetAsList(&ordinal_list_value)) |
77 return ordinal_list_value; | 77 return ordinal_list_value; |
78 | 78 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 std::string GetOemAppsFolderName() { | 194 std::string GetOemAppsFolderName() { |
195 // |loader_instance| could be NULL for test. | 195 // |loader_instance| could be NULL for test. |
196 if (!loader_instance) | 196 if (!loader_instance) |
197 return std::string(); | 197 return std::string(); |
198 else | 198 else |
199 return loader_instance->GetOemAppsFolderName(); | 199 return loader_instance->GetOemAppsFolderName(); |
200 } | 200 } |
201 | 201 |
202 } // namespace default_app_order | 202 } // namespace default_app_order |
203 } // namespace chromeos | 203 } // namespace chromeos |
OLD | NEW |