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

Side by Side Diff: base/files/file.cc

Issue 308613002: [fsp] Convert base::File::Error to string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 6 years, 6 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 | « base/files/file.h ('k') | no next file » | 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) 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 {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 #if !defined(OS_NACL) 78 #if !defined(OS_NACL)
79 void File::Initialize(const FilePath& name, uint32 flags) { 79 void File::Initialize(const FilePath& name, uint32 flags) {
80 if (name.ReferencesParent()) { 80 if (name.ReferencesParent()) {
81 error_details_ = FILE_ERROR_ACCESS_DENIED; 81 error_details_ = FILE_ERROR_ACCESS_DENIED;
82 return; 82 return;
83 } 83 }
84 InitializeUnsafe(name, flags); 84 InitializeUnsafe(name, flags);
85 } 85 }
86 #endif 86 #endif
87 87
88 std::string File::ErrorToString(Error error) {
89 switch (error) {
90 case FILE_OK:
91 return "FILE_OK";
92 case FILE_ERROR_FAILED:
93 return "FILE_ERROR_FAILED";
94 case FILE_ERROR_IN_USE:
95 return "FILE_ERROR_IN_USE";
96 case FILE_ERROR_EXISTS:
97 return "FILE_ERROR_EXISTS";
98 case FILE_ERROR_NOT_FOUND:
99 return "FILE_ERROR_NOT_FOUND";
100 case FILE_ERROR_ACCESS_DENIED:
101 return "FILE_ERROR_ACCESS_DENIED";
102 case FILE_ERROR_TOO_MANY_OPENED:
103 return "FILE_ERROR_TOO_MANY_OPENED";
104 case FILE_ERROR_NO_MEMORY:
105 return "FILE_ERROR_NO_MEMORY";
106 case FILE_ERROR_NO_SPACE:
107 return "FILE_ERROR_NO_SPACE";
108 case FILE_ERROR_NOT_A_DIRECTORY:
109 return "FILE_ERROR_NOT_A_DIRECTORY";
110 case FILE_ERROR_INVALID_OPERATION:
111 return "FILE_ERROR_INVALID_OPERATION";
112 case FILE_ERROR_SECURITY:
113 return "FILE_ERROR_SECURITY";
114 case FILE_ERROR_ABORT:
115 return "FILE_ERROR_ABORT";
116 case FILE_ERROR_NOT_A_FILE:
117 return "FILE_ERROR_NOT_A_FILE";
118 case FILE_ERROR_NOT_EMPTY:
119 return "FILE_ERROR_NOT_EMPTY";
120 case FILE_ERROR_INVALID_URL:
121 return "FILE_ERROR_INVALID_URL";
122 case FILE_ERROR_IO:
123 return "FILE_ERROR_IO";
124 case FILE_ERROR_MAX:
125 break;
126 }
127
128 NOTREACHED();
129 return "";
130 }
131
88 } // namespace base 132 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698