OLD | NEW |
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 "net/tools/tld_cleanup/tld_cleanup_util.h" | 5 #include "net/tools/tld_cleanup/tld_cleanup_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 return result; | 229 return result; |
230 } | 230 } |
231 | 231 |
232 NormalizeResult NormalizeFile(const base::FilePath& in_filename, | 232 NormalizeResult NormalizeFile(const base::FilePath& in_filename, |
233 const base::FilePath& out_filename) { | 233 const base::FilePath& out_filename) { |
234 RuleMap rules; | 234 RuleMap rules; |
235 std::string data; | 235 std::string data; |
236 if (!file_util::ReadFileToString(in_filename, &data)) { | 236 if (!base::ReadFileToString(in_filename, &data)) { |
237 LOG(ERROR) << "Unable to read file"; | 237 LOG(ERROR) << "Unable to read file"; |
238 // We return success since we've already reported the error. | 238 // We return success since we've already reported the error. |
239 return kSuccess; | 239 return kSuccess; |
240 } | 240 } |
241 | 241 |
242 NormalizeResult result = NormalizeDataToRuleMap(data, &rules); | 242 NormalizeResult result = NormalizeDataToRuleMap(data, &rules); |
243 | 243 |
244 if (!WriteRules(rules, out_filename)) { | 244 if (!WriteRules(rules, out_filename)) { |
245 LOG(ERROR) << "Error(s) writing output file"; | 245 LOG(ERROR) << "Error(s) writing output file"; |
246 result = kError; | 246 result = kError; |
247 } | 247 } |
248 | 248 |
249 return result; | 249 return result; |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 } // namespace tld_cleanup | 253 } // namespace tld_cleanup |
254 } // namespace net | 254 } // namespace net |
OLD | NEW |