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

Side by Side Diff: webkit/fileapi/native_file_util.cc

Issue 11747020: Cleanup: Remove using statements from webkit/fileapi header files. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 months 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 | « webkit/fileapi/native_file_util.h ('k') | webkit/fileapi/obfuscated_file_util.h » ('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 "webkit/fileapi/native_file_util.h" 5 #include "webkit/fileapi/native_file_util.h"
6 6
7 #include <vector>
8
9 #include "base/file_util.h" 7 #include "base/file_util.h"
10 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
11 #include "webkit/fileapi/file_system_operation_context.h" 9 #include "webkit/fileapi/file_system_operation_context.h"
12 10
13 namespace fileapi { 11 namespace fileapi {
14 12
15 namespace { 13 namespace {
16 14
17 // Sets permissions on directory at |dir_path| based on the target platform. 15 // Sets permissions on directory at |dir_path| based on the target platform.
18 // Returns true on success, or false otherwise. 16 // Returns true on success, or false otherwise.
19 // 17 //
20 // TODO(benchan): Find a better place outside webkit to host this function. 18 // TODO(benchan): Find a better place outside webkit to host this function.
21 bool SetPlatformSpecificDirectoryPermissions(const FilePath& dir_path) { 19 bool SetPlatformSpecificDirectoryPermissions(const FilePath& dir_path) {
22 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
23 // System daemons on Chrome OS may run as a user different than the Chrome 21 // System daemons on Chrome OS may run as a user different than the Chrome
24 // process but need to access files under the directories created here. 22 // process but need to access files under the directories created here.
25 // Because of that, grant the execute permission on the created directory 23 // Because of that, grant the execute permission on the created directory
26 // to group and other users. 24 // to group and other users.
27 if (HANDLE_EINTR(chmod(dir_path.value().c_str(), 25 if (HANDLE_EINTR(chmod(dir_path.value().c_str(),
28 S_IRWXU | S_IXGRP | S_IXOTH)) != 0) { 26 S_IRWXU | S_IXGRP | S_IXOTH)) != 0) {
29 return false; 27 return false;
30 } 28 }
31 #endif 29 #endif
32 // Keep the directory permissions unchanged on non-Chrome OS platforms. 30 // Keep the directory permissions unchanged on non-Chrome OS platforms.
33 return true; 31 return true;
34 } 32 }
35 33
36 } // namespace 34 } // namespace
37 35
36 using base::PlatformFile;
37 using base::PlatformFileError;
38
38 class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { 39 class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator {
39 public: 40 public:
40 NativeFileEnumerator(const FilePath& root_path, 41 NativeFileEnumerator(const FilePath& root_path,
41 bool recursive, 42 bool recursive,
42 int file_type) 43 int file_type)
43 : file_enum_(root_path, recursive, file_type) { 44 : file_enum_(root_path, recursive, file_type) {
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 memset(&file_util_info_, 0, sizeof(file_util_info_)); 46 memset(&file_util_info_, 0, sizeof(file_util_info_));
46 #endif // defined(OS_WIN) 47 #endif // defined(OS_WIN)
47 } 48 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (!file_util::IsDirectoryEmpty(path)) { 242 if (!file_util::IsDirectoryEmpty(path)) {
242 // TODO(dmikurube): Check if this error code is appropriate. 243 // TODO(dmikurube): Check if this error code is appropriate.
243 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; 244 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
244 } 245 }
245 if (!file_util::Delete(path, false)) 246 if (!file_util::Delete(path, false))
246 return base::PLATFORM_FILE_ERROR_FAILED; 247 return base::PLATFORM_FILE_ERROR_FAILED;
247 return base::PLATFORM_FILE_OK; 248 return base::PLATFORM_FILE_OK;
248 } 249 }
249 250
250 } // namespace fileapi 251 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/native_file_util.h ('k') | webkit/fileapi/obfuscated_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698