| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 switch (httpStatusCode) { | 301 switch (httpStatusCode) { |
| 302 case 403: | 302 case 403: |
| 303 return FileError::SECURITY_ERR; | 303 return FileError::SECURITY_ERR; |
| 304 case 404: | 304 case 404: |
| 305 return FileError::NOT_FOUND_ERR; | 305 return FileError::NOT_FOUND_ERR; |
| 306 default: | 306 default: |
| 307 return FileError::NOT_READABLE_ERR; | 307 return FileError::NOT_READABLE_ERR; |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 DOMArrayBuffer* FileReaderLoader::arrayBufferResult() const | 311 PassRefPtr<DOMArrayBuffer> FileReaderLoader::arrayBufferResult() const |
| 312 { | 312 { |
| 313 ASSERT(m_readType == ReadAsArrayBuffer); | 313 ASSERT(m_readType == ReadAsArrayBuffer); |
| 314 | 314 |
| 315 // If the loading is not started or an error occurs, return an empty result. | 315 // If the loading is not started or an error occurs, return an empty result. |
| 316 if (!m_rawData || m_errorCode) | 316 if (!m_rawData || m_errorCode) |
| 317 return nullptr; | 317 return nullptr; |
| 318 | 318 |
| 319 return DOMArrayBuffer::create(m_rawData->toArrayBuffer()); | 319 return DOMArrayBuffer::create(m_rawData->toArrayBuffer()); |
| 320 } | 320 } |
| 321 | 321 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 m_stringResult = builder.toString(); | 402 m_stringResult = builder.toString(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void FileReaderLoader::setEncoding(const String& encoding) | 405 void FileReaderLoader::setEncoding(const String& encoding) |
| 406 { | 406 { |
| 407 if (!encoding.isEmpty()) | 407 if (!encoding.isEmpty()) |
| 408 m_encoding = WTF::TextEncoding(encoding); | 408 m_encoding = WTF::TextEncoding(encoding); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace blink | 411 } // namespace blink |
| OLD | NEW |