OLD | NEW |
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 "webkit/browser/fileapi/native_file_util.h" | 5 #include "webkit/browser/fileapi/native_file_util.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "webkit/browser/fileapi/file_system_operation_context.h" | 11 #include "webkit/browser/fileapi/file_system_operation_context.h" |
12 #include "webkit/browser/fileapi/file_system_url.h" | 12 #include "webkit/browser/fileapi/file_system_url.h" |
13 | 13 |
14 namespace fileapi { | 14 namespace storage { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 // Sets permissions on directory at |dir_path| based on the target platform. | 18 // Sets permissions on directory at |dir_path| based on the target platform. |
19 // Returns true on success, or false otherwise. | 19 // Returns true on success, or false otherwise. |
20 // | 20 // |
21 // TODO(benchan): Find a better place outside webkit to host this function. | 21 // TODO(benchan): Find a better place outside webkit to host this function. |
22 bool SetPlatformSpecificDirectoryPermissions(const base::FilePath& dir_path) { | 22 bool SetPlatformSpecificDirectoryPermissions(const base::FilePath& dir_path) { |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 // System daemons on Chrome OS may run as a user different than the Chrome | 24 // System daemons on Chrome OS may run as a user different than the Chrome |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return base::File::FILE_ERROR_NOT_FOUND; | 305 return base::File::FILE_ERROR_NOT_FOUND; |
306 if (!base::DirectoryExists(path)) | 306 if (!base::DirectoryExists(path)) |
307 return base::File::FILE_ERROR_NOT_A_DIRECTORY; | 307 return base::File::FILE_ERROR_NOT_A_DIRECTORY; |
308 if (!base::IsDirectoryEmpty(path)) | 308 if (!base::IsDirectoryEmpty(path)) |
309 return base::File::FILE_ERROR_NOT_EMPTY; | 309 return base::File::FILE_ERROR_NOT_EMPTY; |
310 if (!base::DeleteFile(path, false)) | 310 if (!base::DeleteFile(path, false)) |
311 return base::File::FILE_ERROR_FAILED; | 311 return base::File::FILE_ERROR_FAILED; |
312 return base::File::FILE_OK; | 312 return base::File::FILE_OK; |
313 } | 313 } |
314 | 314 |
315 } // namespace fileapi | 315 } // namespace storage |
OLD | NEW |