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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_external_updater.cc

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add ::From Created 5 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 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 26 matching lines...) Expand all
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 JSONFileValueDeserializer deserializer(manifest); 45 JSONFileValueDeserializer deserializer(manifest);
46 std::string error_msg; 46 std::string error_msg;
47 base::Value* extensions = deserializer.Deserialize(NULL, &error_msg); 47 base::Value* extensions =
48 deserializer.Deserialize(NULL, &error_msg).release();
49 // TODO(Olli Raula) possible memoryleak http://crbug.com/543015
Lei Zhang 2015/10/14 16:46:14 memory leak is two words.
48 if (!extensions) { 50 if (!extensions) {
49 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; 51 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST;
50 return; 52 return;
51 } 53 }
52 54
53 base::DictionaryValue* dict_value = NULL; 55 base::DictionaryValue* dict_value = NULL;
54 if (!extensions->GetAsDictionary(&dict_value)) { 56 if (!extensions->GetAsDictionary(&dict_value)) {
55 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST; 57 *error_code = KioskExternalUpdater::ERROR_INVALID_MANIFEST;
56 return; 58 return;
57 } 59 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (failed) { 526 if (failed) {
525 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString( 527 failed_app_msg = ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
526 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) + 528 IDS_KIOSK_EXTERNAL_UPDATE_FAILED_UPDATED_APPS) +
527 base::ASCIIToUTF16("\n") + failed_apps; 529 base::ASCIIToUTF16("\n") + failed_apps;
528 message = message + base::ASCIIToUTF16("\n") + failed_app_msg; 530 message = message + base::ASCIIToUTF16("\n") + failed_app_msg;
529 } 531 }
530 return message; 532 return message;
531 } 533 }
532 534
533 } // namespace chromeos 535 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698