| 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 "chromeos/system/name_value_pairs_parser.h" | 5 #include "chromeos/system/name_value_pairs_parser.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 bool NameValuePairsParser::GetNameValuePairsFromFile( | 120 bool NameValuePairsParser::GetNameValuePairsFromFile( |
| 121 const base::FilePath& file_path, | 121 const base::FilePath& file_path, |
| 122 const std::string& eq, | 122 const std::string& eq, |
| 123 const std::string& delim) { | 123 const std::string& delim) { |
| 124 std::string contents; | 124 std::string contents; |
| 125 if (base::ReadFileToString(file_path, &contents)) { | 125 if (base::ReadFileToString(file_path, &contents)) { |
| 126 return ParseNameValuePairs(contents, eq, delim); | 126 return ParseNameValuePairs(contents, eq, delim); |
| 127 } else { | 127 } else { |
| 128 if (base::SysInfo::IsRunningOnChromeOS()) | 128 if (base::SysInfo::IsRunningOnChromeOS()) |
| 129 LOG(WARNING) << "Unable to read statistics file: " << file_path.value(); | 129 VLOG(1) << "Statistics file not present: " << file_path.value(); |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool NameValuePairsParser::ParseNameValuePairsFromTool( | 134 bool NameValuePairsParser::ParseNameValuePairsFromTool( |
| 135 int argc, | 135 int argc, |
| 136 const char* argv[], | 136 const char* argv[], |
| 137 const std::string& eq, | 137 const std::string& eq, |
| 138 const std::string& delim, | 138 const std::string& delim, |
| 139 const std::string& comment_delim) { | 139 const std::string& comment_delim) { |
| 140 std::string output_string; | 140 std::string output_string; |
| 141 if (!GetToolOutput(argc, argv, output_string)) | 141 if (!GetToolOutput(argc, argv, output_string)) |
| 142 return false; | 142 return false; |
| 143 | 143 |
| 144 return ParseNameValuePairsWithComments( | 144 return ParseNameValuePairsWithComments( |
| 145 output_string, eq, delim, comment_delim); | 145 output_string, eq, delim, comment_delim); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace system | 148 } // namespace system |
| 149 } // namespace chromeos | 149 } // namespace chromeos |
| OLD | NEW |