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

Side by Side Diff: base/platform_file.h

Issue 10392181: Implement serial API for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix weird Windows build error. Created 8 years, 7 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
OLDNEW
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 #ifndef BASE_PLATFORM_FILE_H_ 5 #ifndef BASE_PLATFORM_FILE_H_
6 #define BASE_PLATFORM_FILE_H_ 6 #define BASE_PLATFORM_FILE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 14 matching lines...) Expand all
25 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE; 25 const PlatformFile kInvalidPlatformFileValue = INVALID_HANDLE_VALUE;
26 #elif defined(OS_POSIX) 26 #elif defined(OS_POSIX)
27 typedef int PlatformFile; 27 typedef int PlatformFile;
28 const PlatformFile kInvalidPlatformFileValue = -1; 28 const PlatformFile kInvalidPlatformFileValue = -1;
29 #endif 29 #endif
30 30
31 // PLATFORM_FILE_(OPEN|CREATE).* are mutually exclusive. You should specify 31 // PLATFORM_FILE_(OPEN|CREATE).* are mutually exclusive. You should specify
32 // exactly one of the five (possibly combining with other flags) when opening 32 // exactly one of the five (possibly combining with other flags) when opening
33 // or creating a file. 33 // or creating a file.
34 enum PlatformFileFlags { 34 enum PlatformFileFlags {
35 PLATFORM_FILE_OPEN = 1, // Opens a file, only if it exists. 35 PLATFORM_FILE_OPEN = 1 << 0, // Opens a file, only if it exists.
36 PLATFORM_FILE_CREATE = 2, // Creates a new file, only if it does not 36 PLATFORM_FILE_CREATE = 1 << 1, // Creates a new file, only if it
37 // already exist. 37 // does not already exist.
38 PLATFORM_FILE_OPEN_ALWAYS = 4, // May create a new file. 38 PLATFORM_FILE_OPEN_ALWAYS = 1 << 2, // May create a new file.
39 PLATFORM_FILE_CREATE_ALWAYS = 8, // May overwrite an old file. 39 PLATFORM_FILE_CREATE_ALWAYS = 1 << 3, // May overwrite an old file.
40 PLATFORM_FILE_OPEN_TRUNCATED = 16, // Opens a file and truncates it, only if 40 PLATFORM_FILE_OPEN_TRUNCATED = 1 << 4, // Opens a file and truncates it,
41 // it exists. 41 // only if it exists.
42 PLATFORM_FILE_READ = 32, 42 PLATFORM_FILE_READ = 1 << 5,
43 PLATFORM_FILE_WRITE = 64, 43 PLATFORM_FILE_WRITE = 1 << 6,
44 PLATFORM_FILE_EXCLUSIVE_READ = 128, // EXCLUSIVE is opposite of Windows SHARE 44 PLATFORM_FILE_EXCLUSIVE_READ = 1 << 7, // EXCLUSIVE is opposite of Windows
45 PLATFORM_FILE_EXCLUSIVE_WRITE = 256, 45 // SHARE
46 PLATFORM_FILE_ASYNC = 512, 46 PLATFORM_FILE_EXCLUSIVE_WRITE = 1 << 8,
47 PLATFORM_FILE_TEMPORARY = 1024, // Used on Windows only 47 PLATFORM_FILE_ASYNC = 1 << 9,
48 PLATFORM_FILE_HIDDEN = 2048, // Used on Windows only 48 PLATFORM_FILE_TEMPORARY = 1 << 10, // Used on Windows only
49 PLATFORM_FILE_DELETE_ON_CLOSE = 4096, 49 PLATFORM_FILE_HIDDEN = 1 << 11, // Used on Windows only
50 PLATFORM_FILE_DELETE_ON_CLOSE = 1 << 12,
50 51
51 PLATFORM_FILE_WRITE_ATTRIBUTES = 8192, // Used on Windows only 52 PLATFORM_FILE_WRITE_ATTRIBUTES = 1 << 13, // Used on Windows only
52 PLATFORM_FILE_ENUMERATE = 16384, // May enumerate directory 53 PLATFORM_FILE_ENUMERATE = 1 << 14, // May enumerate directory
53 54
54 PLATFORM_FILE_SHARE_DELETE = 32768, // Used on Windows only 55 PLATFORM_FILE_SHARE_DELETE = 1 << 15, // Used on Windows only
56
57 PLATFORM_FILE_TERMINAL_DEVICE = 1 << 16, // Serial port flags
55 }; 58 };
56 59
57 // PLATFORM_FILE_ERROR_ACCESS_DENIED is returned when a call fails because of 60 // PLATFORM_FILE_ERROR_ACCESS_DENIED is returned when a call fails because of
58 // a filesystem restriction. PLATFORM_FILE_ERROR_SECURITY is returned when a 61 // a filesystem restriction. PLATFORM_FILE_ERROR_SECURITY is returned when a
59 // browser policy doesn't allow the operation to be executed. 62 // browser policy doesn't allow the operation to be executed.
60 enum PlatformFileError { 63 enum PlatformFileError {
61 PLATFORM_FILE_OK = 0, 64 PLATFORM_FILE_OK = 0,
62 PLATFORM_FILE_ERROR_FAILED = -1, 65 PLATFORM_FILE_ERROR_FAILED = -1,
63 PLATFORM_FILE_ERROR_IN_USE = -2, 66 PLATFORM_FILE_ERROR_IN_USE = -2,
64 PLATFORM_FILE_ERROR_EXISTS = -3, 67 PLATFORM_FILE_ERROR_EXISTS = -3,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return temp; 190 return temp;
188 } 191 }
189 192
190 private: 193 private:
191 PlatformFile* value_; 194 PlatformFile* value_;
192 }; 195 };
193 196
194 } // namespace base 197 } // namespace base
195 198
196 #endif // BASE_PLATFORM_FILE_H_ 199 #endif // BASE_PLATFORM_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | base/platform_file_posix.cc » ('j') | chrome/browser/extensions/api/api_resource_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698