OLD | NEW |
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 "chrome/browser/chromeos/drive/file_errors.h" | 5 #include "chrome/browser/chromeos/drive/file_errors.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace drive { | 9 namespace drive { |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return "FILE_ERROR_NO_LOCAL_SPACE"; | 65 return "FILE_ERROR_NO_LOCAL_SPACE"; |
66 | 66 |
67 case FILE_ERROR_SERVICE_UNAVAILABLE: | 67 case FILE_ERROR_SERVICE_UNAVAILABLE: |
68 return "FILE_ERROR_SERVICE_UNAVAILABLE"; | 68 return "FILE_ERROR_SERVICE_UNAVAILABLE"; |
69 } | 69 } |
70 | 70 |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 return ""; | 72 return ""; |
73 } | 73 } |
74 | 74 |
75 base::PlatformFileError FileErrorToPlatformError(FileError error) { | 75 base::File::Error FileErrorToBaseFileError(FileError error) { |
76 switch (error) { | 76 switch (error) { |
77 case FILE_ERROR_OK: | 77 case FILE_ERROR_OK: |
78 return base::PLATFORM_FILE_OK; | 78 return base::File::FILE_OK; |
79 | 79 |
80 case FILE_ERROR_FAILED: | 80 case FILE_ERROR_FAILED: |
81 return base::PLATFORM_FILE_ERROR_FAILED; | 81 return base::File::FILE_ERROR_FAILED; |
82 | 82 |
83 case FILE_ERROR_IN_USE: | 83 case FILE_ERROR_IN_USE: |
84 return base::PLATFORM_FILE_ERROR_IN_USE; | 84 return base::File::FILE_ERROR_IN_USE; |
85 | 85 |
86 case FILE_ERROR_EXISTS: | 86 case FILE_ERROR_EXISTS: |
87 return base::PLATFORM_FILE_ERROR_EXISTS; | 87 return base::File::FILE_ERROR_EXISTS; |
88 | 88 |
89 case FILE_ERROR_NOT_FOUND: | 89 case FILE_ERROR_NOT_FOUND: |
90 return base::PLATFORM_FILE_ERROR_NOT_FOUND; | 90 return base::File::FILE_ERROR_NOT_FOUND; |
91 | 91 |
92 case FILE_ERROR_ACCESS_DENIED: | 92 case FILE_ERROR_ACCESS_DENIED: |
93 return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; | 93 return base::File::FILE_ERROR_ACCESS_DENIED; |
94 | 94 |
95 case FILE_ERROR_TOO_MANY_OPENED: | 95 case FILE_ERROR_TOO_MANY_OPENED: |
96 return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED; | 96 return base::File::FILE_ERROR_TOO_MANY_OPENED; |
97 | 97 |
98 case FILE_ERROR_NO_MEMORY: | 98 case FILE_ERROR_NO_MEMORY: |
99 return base::PLATFORM_FILE_ERROR_NO_MEMORY; | 99 return base::File::FILE_ERROR_NO_MEMORY; |
100 | 100 |
101 case FILE_ERROR_NO_SERVER_SPACE: | 101 case FILE_ERROR_NO_SERVER_SPACE: |
102 return base::PLATFORM_FILE_ERROR_NO_SPACE; | 102 return base::File::FILE_ERROR_NO_SPACE; |
103 | 103 |
104 case FILE_ERROR_NOT_A_DIRECTORY: | 104 case FILE_ERROR_NOT_A_DIRECTORY: |
105 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; | 105 return base::File::FILE_ERROR_NOT_A_DIRECTORY; |
106 | 106 |
107 case FILE_ERROR_INVALID_OPERATION: | 107 case FILE_ERROR_INVALID_OPERATION: |
108 return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; | 108 return base::File::FILE_ERROR_INVALID_OPERATION; |
109 | 109 |
110 case FILE_ERROR_SECURITY: | 110 case FILE_ERROR_SECURITY: |
111 return base::PLATFORM_FILE_ERROR_SECURITY; | 111 return base::File::FILE_ERROR_SECURITY; |
112 | 112 |
113 case FILE_ERROR_ABORT: | 113 case FILE_ERROR_ABORT: |
114 return base::PLATFORM_FILE_ERROR_ABORT; | 114 return base::File::FILE_ERROR_ABORT; |
115 | 115 |
116 case FILE_ERROR_NOT_A_FILE: | 116 case FILE_ERROR_NOT_A_FILE: |
117 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 117 return base::File::FILE_ERROR_NOT_A_FILE; |
118 | 118 |
119 case FILE_ERROR_NOT_EMPTY: | 119 case FILE_ERROR_NOT_EMPTY: |
120 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; | 120 return base::File::FILE_ERROR_NOT_EMPTY; |
121 | 121 |
122 case FILE_ERROR_INVALID_URL: | 122 case FILE_ERROR_INVALID_URL: |
123 return base::PLATFORM_FILE_ERROR_INVALID_URL; | 123 return base::File::FILE_ERROR_INVALID_URL; |
124 | 124 |
125 case FILE_ERROR_NO_CONNECTION: | 125 case FILE_ERROR_NO_CONNECTION: |
126 return base::PLATFORM_FILE_ERROR_FAILED; | 126 return base::File::FILE_ERROR_FAILED; |
127 | 127 |
128 case FILE_ERROR_NO_LOCAL_SPACE: | 128 case FILE_ERROR_NO_LOCAL_SPACE: |
129 return base::PLATFORM_FILE_ERROR_FAILED; | 129 return base::File::FILE_ERROR_FAILED; |
130 | 130 |
131 case FILE_ERROR_SERVICE_UNAVAILABLE: | 131 case FILE_ERROR_SERVICE_UNAVAILABLE: |
132 return base::PLATFORM_FILE_ERROR_FAILED; | 132 return base::File::FILE_ERROR_FAILED; |
133 } | 133 } |
134 | 134 |
135 NOTREACHED(); | 135 NOTREACHED(); |
136 return base::PLATFORM_FILE_ERROR_FAILED; | 136 return base::File::FILE_ERROR_FAILED; |
137 } | 137 } |
138 | 138 |
139 FileError GDataToFileError(google_apis::GDataErrorCode status) { | 139 FileError GDataToFileError(google_apis::GDataErrorCode status) { |
140 switch (status) { | 140 switch (status) { |
141 case google_apis::HTTP_SUCCESS: | 141 case google_apis::HTTP_SUCCESS: |
142 case google_apis::HTTP_CREATED: | 142 case google_apis::HTTP_CREATED: |
143 case google_apis::HTTP_NO_CONTENT: | 143 case google_apis::HTTP_NO_CONTENT: |
144 return FILE_ERROR_OK; | 144 return FILE_ERROR_OK; |
145 case google_apis::HTTP_UNAUTHORIZED: | 145 case google_apis::HTTP_UNAUTHORIZED: |
146 case google_apis::HTTP_FORBIDDEN: | 146 case google_apis::HTTP_FORBIDDEN: |
(...skipping 11 matching lines...) Expand all Loading... |
158 case google_apis::GDATA_NO_CONNECTION: | 158 case google_apis::GDATA_NO_CONNECTION: |
159 return FILE_ERROR_NO_CONNECTION; | 159 return FILE_ERROR_NO_CONNECTION; |
160 case google_apis::GDATA_NO_SPACE: | 160 case google_apis::GDATA_NO_SPACE: |
161 return FILE_ERROR_NO_SERVER_SPACE; | 161 return FILE_ERROR_NO_SERVER_SPACE; |
162 default: | 162 default: |
163 return FILE_ERROR_FAILED; | 163 return FILE_ERROR_FAILED; |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 } // namespace drive | 167 } // namespace drive |
OLD | NEW |