| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/files/file.h" | 5 #include "base/files/file.h" | 
| 6 | 6 | 
| 7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue). | 7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue). | 
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" | 
| 9 | 9 | 
| 10 namespace base { | 10 namespace base { | 
| 11 | 11 | 
| 12 File::Info::Info() | 12 File::Info::Info() | 
| 13     : size(0), | 13     : size(0), | 
| 14       is_directory(false), | 14       is_directory(false), | 
| 15       is_symbolic_link(false) { | 15       is_symbolic_link(false) { | 
| 16 } | 16 } | 
| 17 | 17 | 
| 18 File::Info::~Info() { | 18 File::Info::~Info() { | 
| 19 } | 19 } | 
| 20 | 20 | 
| 21 File::File() | 21 File::File() | 
| 22     : file_(kInvalidPlatformFileValue), | 22     : file_(kInvalidPlatformFileValue), | 
| 23       error_details_(FILE_OK), | 23       error_details_(FILE_ERROR_FAILED), | 
| 24       created_(false), | 24       created_(false), | 
| 25       async_(false) { | 25       async_(false) { | 
| 26 } | 26 } | 
| 27 | 27 | 
| 28 #if !defined(OS_NACL) | 28 #if !defined(OS_NACL) | 
| 29 File::File(const FilePath& name, uint32 flags) | 29 File::File(const FilePath& name, uint32 flags) | 
| 30     : file_(kInvalidPlatformFileValue), | 30     : file_(kInvalidPlatformFileValue), | 
| 31       error_details_(FILE_OK), | 31       error_details_(FILE_OK), | 
| 32       created_(false), | 32       created_(false), | 
| 33       async_(false) { | 33       async_(false) { | 
| 34   Initialize(name, flags); | 34   Initialize(name, flags); | 
| 35 } | 35 } | 
| 36 #endif | 36 #endif | 
| 37 | 37 | 
| 38 File::File(PlatformFile platform_file) | 38 File::File(PlatformFile platform_file) | 
| 39     : file_(platform_file), | 39     : file_(platform_file), | 
| 40       error_details_(FILE_OK), | 40       error_details_(FILE_OK), | 
| 41       created_(false), | 41       created_(false), | 
| 42       async_(false) { | 42       async_(false) { | 
| 43 #if defined(OS_POSIX) | 43 #if defined(OS_POSIX) | 
| 44   DCHECK_GE(platform_file, -1); | 44   DCHECK_GE(platform_file, -1); | 
| 45 #endif | 45 #endif | 
| 46 } | 46 } | 
| 47 | 47 | 
|  | 48 File::File(Error error_details) | 
|  | 49     : file_(kInvalidPlatformFileValue), | 
|  | 50       error_details_(error_details), | 
|  | 51       created_(false), | 
|  | 52       async_(false) { | 
|  | 53 } | 
|  | 54 | 
| 48 File::File(RValue other) | 55 File::File(RValue other) | 
| 49     : file_(other.object->TakePlatformFile()), | 56     : file_(other.object->TakePlatformFile()), | 
| 50       error_details_(other.object->error_details()), | 57       error_details_(other.object->error_details()), | 
| 51       created_(other.object->created()), | 58       created_(other.object->created()), | 
| 52       async_(other.object->async_) { | 59       async_(other.object->async_) { | 
| 53 } | 60 } | 
| 54 | 61 | 
| 55 File::~File() { | 62 File::~File() { | 
| 56 } | 63 } | 
| 57 | 64 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 70 void File::Initialize(const FilePath& name, uint32 flags) { | 77 void File::Initialize(const FilePath& name, uint32 flags) { | 
| 71   if (name.ReferencesParent()) { | 78   if (name.ReferencesParent()) { | 
| 72     error_details_ = FILE_ERROR_ACCESS_DENIED; | 79     error_details_ = FILE_ERROR_ACCESS_DENIED; | 
| 73     return; | 80     return; | 
| 74   } | 81   } | 
| 75   InitializeUnsafe(name, flags); | 82   InitializeUnsafe(name, flags); | 
| 76 } | 83 } | 
| 77 #endif | 84 #endif | 
| 78 | 85 | 
| 79 }  // namespace base | 86 }  // namespace base | 
| OLD | NEW | 
|---|