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

Side by Side Diff: net/tools/dump_cache/cache_dumper.cc

Issue 100573002: Move directory creation functions 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
« no previous file with comments | « net/tools/crash_cache/crash_cache.cc ('k') | net/url_request/url_fetcher_impl_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/tools/dump_cache/cache_dumper.h" 5 #include "net/tools/dump_cache/cache_dumper.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Create the subdirectories individually 58 // Create the subdirectories individually
59 while ((pos = path.value().find(backslash, pos)) != std::wstring::npos) { 59 while ((pos = path.value().find(backslash, pos)) != std::wstring::npos) {
60 base::FilePath::StringType subdir = path.value().substr(0, pos); 60 base::FilePath::StringType subdir = path.value().substr(0, pos);
61 CreateDirectoryW(subdir.c_str(), NULL); 61 CreateDirectoryW(subdir.c_str(), NULL);
62 // we keep going even if directory creation failed. 62 // we keep going even if directory creation failed.
63 pos++; 63 pos++;
64 } 64 }
65 // Now create the full path 65 // Now create the full path
66 return CreateDirectoryW(path.value().c_str(), NULL) == TRUE; 66 return CreateDirectoryW(path.value().c_str(), NULL) == TRUE;
67 #else 67 #else
68 return file_util::CreateDirectory(path); 68 return base::CreateDirectory(path);
69 #endif 69 #endif
70 } 70 }
71 71
72 DiskDumper::DiskDumper(const base::FilePath& path) 72 DiskDumper::DiskDumper(const base::FilePath& path)
73 : path_(path), entry_(NULL) { 73 : path_(path), entry_(NULL) {
74 file_util::CreateDirectory(path); 74 base::CreateDirectory(path);
75 } 75 }
76 76
77 int DiskDumper::CreateEntry(const std::string& key, 77 int DiskDumper::CreateEntry(const std::string& key,
78 disk_cache::Entry** entry, 78 disk_cache::Entry** entry,
79 const net::CompletionCallback& callback) { 79 const net::CompletionCallback& callback) {
80 // The URL may not start with a valid protocol; search for it. 80 // The URL may not start with a valid protocol; search for it.
81 int urlpos = key.find("http"); 81 int urlpos = key.find("http");
82 std::string url = urlpos > 0 ? key.substr(urlpos) : key; 82 std::string url = urlpos > 0 ? key.substr(urlpos) : key;
83 std::string base_path = path_.MaybeAsASCII(); 83 std::string base_path = path_.MaybeAsASCII();
84 std::string new_path = 84 std::string new_path =
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, 216 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used,
217 base::Time last_modified) { 217 base::Time last_modified) {
218 #ifdef WIN32_LARGE_FILENAME_SUPPORT 218 #ifdef WIN32_LARGE_FILENAME_SUPPORT
219 CloseHandle(entry_); 219 CloseHandle(entry_);
220 #else 220 #else
221 file_util::CloseFile(entry_); 221 file_util::CloseFile(entry_);
222 #endif 222 #endif
223 } 223 }
OLDNEW
« no previous file with comments | « net/tools/crash_cache/crash_cache.cc ('k') | net/url_request/url_fetcher_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698