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

Side by Side Diff: content/browser/download/base_file.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
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 "content/browser/download/base_file.h" 5 #include "content/browser/download/base_file.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return DOWNLOAD_INTERRUPT_REASON_NONE; 158 return DOWNLOAD_INTERRUPT_REASON_NONE;
159 159
160 // Save the information whether the download is in progress because 160 // Save the information whether the download is in progress because
161 // it will be overwritten by closing the file. 161 // it will be overwritten by closing the file.
162 bool was_in_progress = in_progress(); 162 bool was_in_progress = in_progress();
163 163
164 bound_net_log_.BeginEvent( 164 bound_net_log_.BeginEvent(
165 net::NetLog::TYPE_DOWNLOAD_FILE_RENAMED, 165 net::NetLog::TYPE_DOWNLOAD_FILE_RENAMED,
166 base::Bind(&FileRenamedNetLogCallback, &full_path_, &new_path)); 166 base::Bind(&FileRenamedNetLogCallback, &full_path_, &new_path));
167 Close(); 167 Close();
168 file_util::CreateDirectory(new_path.DirName()); 168 base::CreateDirectory(new_path.DirName());
169 169
170 // A simple rename wouldn't work here since we want the file to have 170 // A simple rename wouldn't work here since we want the file to have
171 // permissions / security descriptors that makes sense in the new directory. 171 // permissions / security descriptors that makes sense in the new directory.
172 rename_result = MoveFileAndAdjustPermissions(new_path); 172 rename_result = MoveFileAndAdjustPermissions(new_path);
173 173
174 if (rename_result == DOWNLOAD_INTERRUPT_REASON_NONE) { 174 if (rename_result == DOWNLOAD_INTERRUPT_REASON_NONE) {
175 full_path_ = new_path; 175 full_path_ = new_path;
176 // Re-open the file if we were still using it. 176 // Re-open the file if we were still using it.
177 if (was_in_progress) 177 if (was_in_progress)
178 rename_result = Open(); 178 rename_result = Open();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 const char* operation, 362 const char* operation,
363 int os_error, 363 int os_error,
364 DownloadInterruptReason reason) { 364 DownloadInterruptReason reason) {
365 bound_net_log_.AddEvent( 365 bound_net_log_.AddEvent(
366 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR, 366 net::NetLog::TYPE_DOWNLOAD_FILE_ERROR,
367 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason)); 367 base::Bind(&FileInterruptedNetLogCallback, operation, os_error, reason));
368 return reason; 368 return reason;
369 } 369 }
370 370
371 } // namespace content 371 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_context_impl.cc ('k') | content/browser/download/base_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698