| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_mode/kiosk_external_updater.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_external_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const base::FilePath& external_update_dir, | 35 const base::FilePath& external_update_dir, |
| 36 base::DictionaryValue* parsed_manifest, | 36 base::DictionaryValue* parsed_manifest, |
| 37 KioskExternalUpdater::ExternalUpdateErrorCode* error_code) { | 37 KioskExternalUpdater::ExternalUpdateErrorCode* error_code) { |
| 38 base::FilePath manifest = | 38 base::FilePath manifest = |
| 39 external_update_dir.AppendASCII(kExternalUpdateManifest); | 39 external_update_dir.AppendASCII(kExternalUpdateManifest); |
| 40 if (!base::PathExists(manifest)) { | 40 if (!base::PathExists(manifest)) { |
| 41 *error_code = KioskExternalUpdater::ERROR_NO_MANIFEST; | 41 *error_code = KioskExternalUpdater::ERROR_NO_MANIFEST; |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 JSONFileValueSerializer serializer(manifest); | 45 JSONFileValueDeserializer deserializer(manifest); |
| 46 std::string error_msg; | 46 std::string error_msg; |
| 47 base::Value* extensions = serializer.Deserialize(NULL, &error_msg); | 47 base::Value* extensions = deserializer.Deserialize(NULL, &error_msg); |
| 48 if (!extensions) { | 48 if (!extensions) { |
| 49 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; | 49 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 | 52 |
| 53 base::DictionaryValue* dict_value = NULL; | 53 base::DictionaryValue* dict_value = NULL; |
| 54 if (!extensions->GetAsDictionary(&dict_value)) { | 54 if (!extensions->GetAsDictionary(&dict_value)) { |
| 55 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; | 55 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; |
| 56 return; | 56 return; |
| 57 } | 57 } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 if (failed) { | 525 if (failed) { |
| 526 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString( | 526 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString( |
| 527 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) + | 527 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) + |
| 528 base::ASCIIToUTF16("\n") + failed_apps; | 528 base::ASCIIToUTF16("\n") + failed_apps; |
| 529 message = message + base::ASCIIToUTF16("\n") + failed_app_msg; | 529 message = message + base::ASCIIToUTF16("\n") + failed_app_msg; |
| 530 } | 530 } |
| 531 return message; | 531 return message; |
| 532 } | 532 } |
| 533 | 533 |
| 534 } // namespace chromeos | 534 } // namespace chromeos |
| OLD | NEW |