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

Side by Side Diff: chrome/installer/util/uninstall_metrics.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 todo about not failed trybot 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/installer/util/uninstall_metrics.h" 5 #include "chrome/installer/util/uninstall_metrics.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 return true; 73 return true;
74 } 74 }
75 75
76 bool ExtractUninstallMetricsFromFile(const base::FilePath& file_path, 76 bool ExtractUninstallMetricsFromFile(const base::FilePath& file_path,
77 base::string16* uninstall_metrics_string) { 77 base::string16* uninstall_metrics_string) {
78 JSONFileValueDeserializer json_deserializer(file_path); 78 JSONFileValueDeserializer json_deserializer(file_path);
79 79
80 std::string json_error_string; 80 std::string json_error_string;
81 scoped_ptr<base::Value> root(json_deserializer.Deserialize(NULL, NULL)); 81 scoped_ptr<base::Value> root = json_deserializer.Deserialize(NULL, NULL);
82 if (!root.get()) 82 if (!root.get())
83 return false; 83 return false;
84 84
85 // Preferences should always have a dictionary root. 85 // Preferences should always have a dictionary root.
86 if (!root->IsType(base::Value::TYPE_DICTIONARY)) 86 if (!root->IsType(base::Value::TYPE_DICTIONARY))
87 return false; 87 return false;
88 88
89 return ExtractUninstallMetrics( 89 return ExtractUninstallMetrics(
90 *static_cast<base::DictionaryValue*>(root.get()), 90 *static_cast<base::DictionaryValue*>(root.get()),
91 uninstall_metrics_string); 91 uninstall_metrics_string);
92 } 92 }
93 93
94 } // namespace installer 94 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_test_util.cc ('k') | chrome/installer/util/uninstall_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698