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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/download_operation.cc

Issue 89523002: Move Posix file utils to the 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/file_system/download_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/download_operation.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // Creates a file with unique name in |dir| and stores the path to |temp_file|. 142 // Creates a file with unique name in |dir| and stores the path to |temp_file|.
143 // Additionally, sets the permission of the file to allow read access from 143 // Additionally, sets the permission of the file to allow read access from
144 // others and group member users (i.e, "-rw-r--r--"). 144 // others and group member users (i.e, "-rw-r--r--").
145 // We need this wrapper because Drive cache files may be read from other 145 // We need this wrapper because Drive cache files may be read from other
146 // processes (e.g., cros_disks for mounting zip files). 146 // processes (e.g., cros_disks for mounting zip files).
147 bool CreateTemporaryReadableFileInDir(const base::FilePath& dir, 147 bool CreateTemporaryReadableFileInDir(const base::FilePath& dir,
148 base::FilePath* temp_file) { 148 base::FilePath* temp_file) {
149 if (!file_util::CreateTemporaryFileInDir(dir, temp_file)) 149 if (!file_util::CreateTemporaryFileInDir(dir, temp_file))
150 return false; 150 return false;
151 return file_util::SetPosixFilePermissions( 151 return base::SetPosixFilePermissions(
152 *temp_file, 152 *temp_file,
153 file_util::FILE_PERMISSION_READ_BY_USER | 153 base::FILE_PERMISSION_READ_BY_USER |
154 file_util::FILE_PERMISSION_WRITE_BY_USER | 154 base::FILE_PERMISSION_WRITE_BY_USER |
155 file_util::FILE_PERMISSION_READ_BY_GROUP | 155 base::FILE_PERMISSION_READ_BY_GROUP |
156 file_util::FILE_PERMISSION_READ_BY_OTHERS); 156 base::FILE_PERMISSION_READ_BY_OTHERS);
157 } 157 }
158 158
159 // Prepares for downloading the file. Allocates the enough space for the file 159 // Prepares for downloading the file. Allocates the enough space for the file
160 // in the cache. 160 // in the cache.
161 // If succeeded, returns FILE_ERROR_OK with |temp_download_file| storing the 161 // If succeeded, returns FILE_ERROR_OK with |temp_download_file| storing the
162 // path to the file in the cache. 162 // path to the file in the cache.
163 FileError PrepareForDownloadFile(internal::FileCache* cache, 163 FileError PrepareForDownloadFile(internal::FileCache* cache,
164 int64 expected_file_size, 164 int64 expected_file_size,
165 const base::FilePath& temporary_file_directory, 165 const base::FilePath& temporary_file_directory,
166 base::FilePath* temp_download_file) { 166 base::FilePath* temp_download_file) {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 observer_->OnDirectoryChangedByOperation(file_path.DirName()); 481 observer_->OnDirectoryChangedByOperation(file_path.DirName());
482 params->OnComplete(*cache_file_path); 482 params->OnComplete(*cache_file_path);
483 } 483 }
484 484
485 void DownloadOperation::CancelJob(JobID job_id) { 485 void DownloadOperation::CancelJob(JobID job_id) {
486 scheduler_->CancelJob(job_id); 486 scheduler_->CancelJob(job_id);
487 } 487 }
488 488
489 } // namespace file_system 489 } // namespace file_system
490 } // namespace drive 490 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache.cc ('k') | chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698