OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 return kSyntaxError; | 94 return kSyntaxError; |
95 case kInvalidModificationErr: | 95 case kInvalidModificationErr: |
96 return kInvalidModificationError; | 96 return kInvalidModificationError; |
97 case kQuotaExceededErr: | 97 case kQuotaExceededErr: |
98 return kQuotaExceededError; | 98 return kQuotaExceededError; |
99 case kTypeMismatchErr: | 99 case kTypeMismatchErr: |
100 return kTypeMismatchError; | 100 return kTypeMismatchError; |
101 case kPathExistsErr: | 101 case kPathExistsErr: |
102 return kPathExistsError; | 102 return kPathExistsError; |
103 default: | 103 default: |
104 ASSERT_NOT_REACHED(); | 104 NOTREACHED(); |
105 return code; | 105 return code; |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 const char* ErrorCodeToMessage(ErrorCode code) { | 109 const char* ErrorCodeToMessage(ErrorCode code) { |
110 // Note that some of these do not set message. If message is 0 then the | 110 // Note that some of these do not set message. If message is 0 then the |
111 // default message is used. | 111 // default message is used. |
112 switch (code) { | 112 switch (code) { |
113 case kOK: | 113 case kOK: |
114 return 0; | 114 return 0; |
(...skipping 15 matching lines...) Expand all Loading... |
130 return kSyntaxErrorMessage; | 130 return kSyntaxErrorMessage; |
131 case kInvalidModificationErr: | 131 case kInvalidModificationErr: |
132 return 0; | 132 return 0; |
133 case kQuotaExceededErr: | 133 case kQuotaExceededErr: |
134 return kQuotaExceededErrorMessage; | 134 return kQuotaExceededErrorMessage; |
135 case kTypeMismatchErr: | 135 case kTypeMismatchErr: |
136 return 0; | 136 return 0; |
137 case kPathExistsErr: | 137 case kPathExistsErr: |
138 return kPathExistsErrorMessage; | 138 return kPathExistsErrorMessage; |
139 default: | 139 default: |
140 ASSERT_NOT_REACHED(); | 140 NOTREACHED(); |
141 return 0; | 141 return 0; |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 void ThrowDOMException(ExceptionState& exception_state, ErrorCode code) { | 147 void ThrowDOMException(ExceptionState& exception_state, ErrorCode code) { |
148 if (code == kOK) | 148 if (code == kOK) |
149 return; | 149 return; |
150 | 150 |
(...skipping 10 matching lines...) Expand all Loading... |
161 | 161 |
162 DOMException* CreateDOMException(ErrorCode code) { | 162 DOMException* CreateDOMException(ErrorCode code) { |
163 DCHECK_NE(code, kOK); | 163 DCHECK_NE(code, kOK); |
164 return DOMException::Create(ErrorCodeToExceptionCode(code), | 164 return DOMException::Create(ErrorCodeToExceptionCode(code), |
165 ErrorCodeToMessage(code)); | 165 ErrorCodeToMessage(code)); |
166 } | 166 } |
167 | 167 |
168 } // namespace FileError | 168 } // namespace FileError |
169 | 169 |
170 } // namespace blink | 170 } // namespace blink |
OLD | NEW |