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

Side by Side Diff: chrome/browser/diagnostics/recon_diagnostics.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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 "chrome/browser/diagnostics/recon_diagnostics.h" 5 #include "chrome/browser/diagnostics/recon_diagnostics.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 "File not found", 184 "File not found",
185 DiagnosticsModel::TEST_FAIL_CONTINUE); 185 DiagnosticsModel::TEST_FAIL_CONTINUE);
186 } else { 186 } else {
187 RecordOutcome(DIAG_RECON_FILE_NOT_FOUND_OK, 187 RecordOutcome(DIAG_RECON_FILE_NOT_FOUND_OK,
188 "File not found (but that is OK)", 188 "File not found (but that is OK)",
189 DiagnosticsModel::TEST_OK); 189 DiagnosticsModel::TEST_OK);
190 } 190 }
191 return true; 191 return true;
192 } 192 }
193 int64 file_size; 193 int64 file_size;
194 if (!file_util::GetFileSize(path_, &file_size)) { 194 if (!base::GetFileSize(path_, &file_size)) {
195 RecordFailure(DIAG_RECON_CANNOT_OBTAIN_FILE_SIZE, 195 RecordFailure(DIAG_RECON_CANNOT_OBTAIN_FILE_SIZE,
196 "Cannot obtain file size"); 196 "Cannot obtain file size");
197 return true; 197 return true;
198 } 198 }
199 199
200 if (file_size > max_file_size_) { 200 if (file_size > max_file_size_) {
201 RecordFailure(DIAG_RECON_FILE_TOO_BIG, "File too big"); 201 RecordFailure(DIAG_RECON_FILE_TOO_BIG, "File too big");
202 return true; 202 return true;
203 } 203 }
204 // Being small enough, we can process it in-memory. 204 // Being small enough, we can process it in-memory.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 RecordFailure( 305 RecordFailure(
306 DIAG_RECON_PATH_NOT_FOUND, 306 DIAG_RECON_PATH_NOT_FOUND,
307 "Path not found: " + UTF16ToUTF8(dir_or_file.LossyDisplayName())); 307 "Path not found: " + UTF16ToUTF8(dir_or_file.LossyDisplayName()));
308 return true; 308 return true;
309 } 309 }
310 310
311 int64 dir_or_file_size = 0; 311 int64 dir_or_file_size = 0;
312 if (path_info_.is_directory) { 312 if (path_info_.is_directory) {
313 dir_or_file_size = base::ComputeDirectorySize(dir_or_file); 313 dir_or_file_size = base::ComputeDirectorySize(dir_or_file);
314 } else { 314 } else {
315 file_util::GetFileSize(dir_or_file, &dir_or_file_size); 315 base::GetFileSize(dir_or_file, &dir_or_file_size);
316 } 316 }
317 if (!dir_or_file_size && !path_info_.is_optional) { 317 if (!dir_or_file_size && !path_info_.is_optional) {
318 RecordFailure(DIAG_RECON_CANNOT_OBTAIN_SIZE, 318 RecordFailure(DIAG_RECON_CANNOT_OBTAIN_SIZE,
319 "Cannot obtain size for: " + 319 "Cannot obtain size for: " +
320 UTF16ToUTF8(dir_or_file.LossyDisplayName())); 320 UTF16ToUTF8(dir_or_file.LossyDisplayName()));
321 return true; 321 return true;
322 } 322 }
323 std::string printable_size = base::Int64ToString(dir_or_file_size); 323 std::string printable_size = base::Int64ToString(dir_or_file_size);
324 324
325 if (path_info_.max_size > 0) { 325 if (path_info_.max_size > 0) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 429
430 DiagnosticsTest* MakeResourcesFileTest() { 430 DiagnosticsTest* MakeResourcesFileTest() {
431 return new PathTest(kPathsToTest[2]); 431 return new PathTest(kPathsToTest[2]);
432 } 432 }
433 433
434 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } 434 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); }
435 435
436 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } 436 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); }
437 437
438 } // namespace diagnostics 438 } // namespace diagnostics
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/owner_key_util.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698