| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void FileReader::stop() | 81 void FileReader::stop() |
| 82 { | 82 { |
| 83 terminate(); | 83 terminate(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void FileReader::readAsBinaryString(Blob* fileBlob) | 86 void FileReader::readAsBinaryString(Blob* fileBlob) |
| 87 { | 87 { |
| 88 // FIXME: needs to handle non-file blobs. |
| 88 LOG(FileAPI, "FileReader: reading as binary: %s\n", fileBlob->path().utf8().
data()); | 89 LOG(FileAPI, "FileReader: reading as binary: %s\n", fileBlob->path().utf8().
data()); |
| 89 | 90 |
| 90 readInternal(fileBlob, ReadFileAsBinaryString); | 91 readInternal(fileBlob, ReadFileAsBinaryString); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void FileReader::readAsText(Blob* fileBlob, const String& encoding) | 94 void FileReader::readAsText(Blob* fileBlob, const String& encoding) |
| 94 { | 95 { |
| 96 // FIXME: needs to handle non-file blobs. |
| 95 LOG(FileAPI, "FileReader: reading as text: %s\n", fileBlob->path().utf8().da
ta()); | 97 LOG(FileAPI, "FileReader: reading as text: %s\n", fileBlob->path().utf8().da
ta()); |
| 96 | 98 |
| 97 if (!encoding.isEmpty()) | 99 if (!encoding.isEmpty()) |
| 98 m_encoding = TextEncoding(encoding); | 100 m_encoding = TextEncoding(encoding); |
| 99 readInternal(fileBlob, ReadFileAsText); | 101 readInternal(fileBlob, ReadFileAsText); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void FileReader::readAsDataURL(File* file) | 104 void FileReader::readAsDataURL(File* file) |
| 103 { | 105 { |
| 104 LOG(FileAPI, "FileReader: reading as data URL: %s\n", file->path().utf8().da
ta()); | 106 LOG(FileAPI, "FileReader: reading as data URL: %s\n", file->path().utf8().da
ta()); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 296 |
| 295 Vector<char> out; | 297 Vector<char> out; |
| 296 base64Encode(m_rawData, out); | 298 base64Encode(m_rawData, out); |
| 297 out.append('\0'); | 299 out.append('\0'); |
| 298 m_result += out.data(); | 300 m_result += out.data(); |
| 299 } | 301 } |
| 300 | 302 |
| 301 } // namespace WebCore | 303 } // namespace WebCore |
| 302 | 304 |
| 303 #endif // ENABLE(FILE_READER) | 305 #endif // ENABLE(FILE_READER) |
| OLD | NEW |