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

Side by Side Diff: chrome/browser/chromeos/drive/download_handler.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 "chrome/browser/chromeos/drive/download_handler.h" 5 #include "chrome/browser/chromeos/drive/download_handler.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/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 DriveUserData* GetDriveUserData(DownloadItem* download) { 50 DriveUserData* GetDriveUserData(DownloadItem* download) {
51 return static_cast<DriveUserData*>(download->GetUserData(&kDrivePathKey)); 51 return static_cast<DriveUserData*>(download->GetUserData(&kDrivePathKey));
52 } 52 }
53 53
54 // Creates a temporary file |drive_tmp_download_path| in 54 // Creates a temporary file |drive_tmp_download_path| in
55 // |drive_tmp_download_dir|. Must be called on a thread that allows file 55 // |drive_tmp_download_dir|. Must be called on a thread that allows file
56 // operations. 56 // operations.
57 base::FilePath GetDriveTempDownloadPath( 57 base::FilePath GetDriveTempDownloadPath(
58 const base::FilePath& drive_tmp_download_dir) { 58 const base::FilePath& drive_tmp_download_dir) {
59 bool created = file_util::CreateDirectory(drive_tmp_download_dir); 59 bool created = base::CreateDirectory(drive_tmp_download_dir);
60 DCHECK(created) << "Can not create temp download directory at " 60 DCHECK(created) << "Can not create temp download directory at "
61 << drive_tmp_download_dir.value(); 61 << drive_tmp_download_dir.value();
62 base::FilePath drive_tmp_download_path; 62 base::FilePath drive_tmp_download_path;
63 created = base::CreateTemporaryFileInDir(drive_tmp_download_dir, 63 created = base::CreateTemporaryFileInDir(drive_tmp_download_dir,
64 &drive_tmp_download_path); 64 &drive_tmp_download_path);
65 DCHECK(created) << "Temporary download file creation failed"; 65 DCHECK(created) << "Temporary download file creation failed";
66 return drive_tmp_download_path; 66 return drive_tmp_download_path;
67 } 67 }
68 68
69 // Moves downloaded file to Drive. 69 // Moves downloaded file to Drive.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void DownloadHandler::UploadDownloadItem(DownloadItem* download) { 303 void DownloadHandler::UploadDownloadItem(DownloadItem* download) {
304 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState()); 304 DCHECK_EQ(DownloadItem::COMPLETE, download->GetState());
305 WriteOnCacheFile( 305 WriteOnCacheFile(
306 file_system_, 306 file_system_,
307 util::ExtractDrivePath(GetTargetPath(download)), 307 util::ExtractDrivePath(GetTargetPath(download)),
308 download->GetMimeType(), 308 download->GetMimeType(),
309 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath())); 309 base::Bind(&MoveDownloadedFile, download->GetTargetFilePath()));
310 } 310 }
311 311
312 } // namespace drive 312 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/app_mode/kiosk_app_data.cc ('k') | chrome/browser/chromeos/drive/drive_integration_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698