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

Side by Side Diff: chrome/installer/util/uninstall_metrics.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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!BuildUninstallMetricsString(uninstall_metrics_dict, 67 if (!BuildUninstallMetricsString(uninstall_metrics_dict,
68 uninstall_metrics_string)) { 68 uninstall_metrics_string)) {
69 return false; 69 return false;
70 } 70 }
71 71
72 return true; 72 return true;
73 } 73 }
74 74
75 bool ExtractUninstallMetricsFromFile(const base::FilePath& file_path, 75 bool ExtractUninstallMetricsFromFile(const base::FilePath& file_path,
76 base::string16* uninstall_metrics_string) { 76 base::string16* uninstall_metrics_string) {
77 JSONFileValueSerializer json_serializer(file_path); 77 JSONFileValueDeserializer json_deserializer(file_path);
78 78
79 std::string json_error_string; 79 std::string json_error_string;
80 scoped_ptr<base::Value> root(json_serializer.Deserialize(NULL, NULL)); 80 scoped_ptr<base::Value> root(json_deserializer.Deserialize(NULL, NULL));
81 if (!root.get()) 81 if (!root.get())
82 return false; 82 return false;
83 83
84 // Preferences should always have a dictionary root. 84 // Preferences should always have a dictionary root.
85 if (!root->IsType(base::Value::TYPE_DICTIONARY)) 85 if (!root->IsType(base::Value::TYPE_DICTIONARY))
86 return false; 86 return false;
87 87
88 return ExtractUninstallMetrics( 88 return ExtractUninstallMetrics(
89 *static_cast<base::DictionaryValue*>(root.get()), 89 *static_cast<base::DictionaryValue*>(root.get()),
90 uninstall_metrics_string); 90 uninstall_metrics_string);
91 } 91 }
92 92
93 } // namespace installer 93 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/master_preferences.cc ('k') | chrome/installer/util/uninstall_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698