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
3 // found in the LICENSE file.
5 #include "base/files/file.h"
7 // TODO(rvargas): remove this (needed for kInvalidPlatformFileValue).
8 #include "base/platform_file.h"
15 is_symbolic_link(false) {
22 : file_(kInvalidPlatformFileValue
),
23 error_details_(FILE_OK
),
29 File::File(const FilePath
& name
, uint32 flags
)
30 : file_(kInvalidPlatformFileValue
),
31 error_details_(FILE_OK
),
34 Initialize(name
, flags
);
38 File::File(PlatformFile platform_file
)
39 : file_(platform_file
),
40 error_details_(FILE_OK
),
45 File::File(RValue other
)
46 : file_(other
.object
->TakePlatformFile()),
47 error_details_(other
.object
->error_details()),
48 created_(other
.object
->created()),
49 async_(other
.object
->async_
) {
56 File
& File::operator=(RValue other
) {
57 if (this != other
.object
) {
59 SetPlatformFile(other
.object
->TakePlatformFile());
60 error_details_
= other
.object
->error_details();
61 created_
= other
.object
->created();
62 async_
= other
.object
->async_
;
68 void File::Initialize(const FilePath
& name
, uint32 flags
) {
69 if (name
.ReferencesParent()) {
70 error_details_
= FILE_ERROR_ACCESS_DENIED
;
73 InitializeUnsafe(name
, flags
);