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

Side by Side Diff: net/dns/dns_hosts.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/cert/test_root_certs.cc ('k') | net/ftp/ftp_directory_listing_parser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/dns/dns_hosts.h" 5 #include "net/dns/dns_hosts.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/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return false; 151 return false;
152 152
153 UMA_HISTOGRAM_COUNTS("AsyncDNS.HostsSize", size); 153 UMA_HISTOGRAM_COUNTS("AsyncDNS.HostsSize", size);
154 154
155 // Reject HOSTS files larger than |kMaxHostsSize| bytes. 155 // Reject HOSTS files larger than |kMaxHostsSize| bytes.
156 const int64 kMaxHostsSize = 1 << 25; // 32MB 156 const int64 kMaxHostsSize = 1 << 25; // 32MB
157 if (size > kMaxHostsSize) 157 if (size > kMaxHostsSize)
158 return false; 158 return false;
159 159
160 std::string contents; 160 std::string contents;
161 if (!file_util::ReadFileToString(path, &contents)) 161 if (!base::ReadFileToString(path, &contents))
162 return false; 162 return false;
163 163
164 ParseHosts(contents, dns_hosts); 164 ParseHosts(contents, dns_hosts);
165 return true; 165 return true;
166 } 166 }
167 167
168 } // namespace net 168 } // namespace net
169 169
OLDNEW
« no previous file with comments | « net/cert/test_root_certs.cc ('k') | net/ftp/ftp_directory_listing_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698