OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "modules/filesystem/InspectorFileSystemAgent.h" | 32 #include "modules/filesystem/InspectorFileSystemAgent.h" |
33 | 33 |
34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 35 #include "core/dom/DOMArrayBuffer.h" |
35 #include "core/dom/DOMImplementation.h" | 36 #include "core/dom/DOMImplementation.h" |
36 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
37 #include "core/events/Event.h" | 38 #include "core/events/Event.h" |
38 #include "core/fileapi/File.h" | 39 #include "core/fileapi/File.h" |
39 #include "core/fileapi/FileError.h" | 40 #include "core/fileapi/FileError.h" |
40 #include "core/fileapi/FileReader.h" | 41 #include "core/fileapi/FileReader.h" |
41 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
42 #include "core/html/VoidCallback.h" | 43 #include "core/html/VoidCallback.h" |
43 #include "core/html/parser/TextResourceDecoder.h" | 44 #include "core/html/parser/TextResourceDecoder.h" |
44 #include "core/inspector/InspectorState.h" | 45 #include "core/inspector/InspectorState.h" |
45 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
46 #include "modules/filesystem/DOMFileSystem.h" | 47 #include "modules/filesystem/DOMFileSystem.h" |
47 #include "modules/filesystem/DirectoryEntry.h" | 48 #include "modules/filesystem/DirectoryEntry.h" |
48 #include "modules/filesystem/DirectoryReader.h" | 49 #include "modules/filesystem/DirectoryReader.h" |
49 #include "modules/filesystem/EntriesCallback.h" | 50 #include "modules/filesystem/EntriesCallback.h" |
50 #include "modules/filesystem/Entry.h" | 51 #include "modules/filesystem/Entry.h" |
51 #include "modules/filesystem/EntryCallback.h" | 52 #include "modules/filesystem/EntryCallback.h" |
52 #include "modules/filesystem/ErrorCallback.h" | 53 #include "modules/filesystem/ErrorCallback.h" |
53 #include "modules/filesystem/FileCallback.h" | 54 #include "modules/filesystem/FileCallback.h" |
54 #include "modules/filesystem/FileEntry.h" | 55 #include "modules/filesystem/FileEntry.h" |
55 #include "modules/filesystem/FileSystemCallbacks.h" | 56 #include "modules/filesystem/FileSystemCallbacks.h" |
56 #include "modules/filesystem/LocalFileSystem.h" | 57 #include "modules/filesystem/LocalFileSystem.h" |
57 #include "modules/filesystem/Metadata.h" | 58 #include "modules/filesystem/Metadata.h" |
58 #include "modules/filesystem/MetadataCallback.h" | 59 #include "modules/filesystem/MetadataCallback.h" |
59 #include "platform/MIMETypeRegistry.h" | 60 #include "platform/MIMETypeRegistry.h" |
60 #include "platform/heap/Handle.h" | 61 #include "platform/heap/Handle.h" |
61 #include "platform/weborigin/KURL.h" | 62 #include "platform/weborigin/KURL.h" |
62 #include "platform/weborigin/SecurityOrigin.h" | 63 #include "platform/weborigin/SecurityOrigin.h" |
63 #include "wtf/ArrayBuffer.h" | |
64 #include "wtf/text/Base64.h" | 64 #include "wtf/text/Base64.h" |
65 #include "wtf/text/TextEncoding.h" | 65 #include "wtf/text/TextEncoding.h" |
66 | 66 |
67 using blink::TypeBuilder::Array; | 67 using blink::TypeBuilder::Array; |
68 | 68 |
69 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestFile
SystemRootCallback RequestFileSystemRootCallback; | 69 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestFile
SystemRootCallback RequestFileSystemRootCallback; |
70 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestDire
ctoryContentCallback RequestDirectoryContentCallback; | 70 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestDire
ctoryContentCallback RequestDirectoryContentCallback; |
71 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestMeta
dataCallback RequestMetadataCallback; | 71 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestMeta
dataCallback RequestMetadataCallback; |
72 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestFile
ContentCallback RequestFileContentCallback; | 72 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::RequestFile
ContentCallback RequestFileContentCallback; |
73 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::DeleteEntry
Callback DeleteEntryCallback; | 73 typedef blink::InspectorBackendDispatcher::FileSystemCommandHandler::DeleteEntry
Callback DeleteEntryCallback; |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 Blob* blob = file->Blob::slice(m_start, m_end, IGNORE_EXCEPTION); | 475 Blob* blob = file->Blob::slice(m_start, m_end, IGNORE_EXCEPTION); |
476 m_reader->setOnload(this); | 476 m_reader->setOnload(this); |
477 m_reader->setOnerror(this); | 477 m_reader->setOnerror(this); |
478 | 478 |
479 m_reader->readAsArrayBuffer(blob, IGNORE_EXCEPTION); | 479 m_reader->readAsArrayBuffer(blob, IGNORE_EXCEPTION); |
480 return true; | 480 return true; |
481 } | 481 } |
482 | 482 |
483 void FileContentRequest::didRead() | 483 void FileContentRequest::didRead() |
484 { | 484 { |
485 RefPtr<ArrayBuffer> buffer = m_reader->arrayBufferResult(); | 485 RefPtr<DOMArrayBuffer> buffer = m_reader->arrayBufferResult(); |
486 | 486 |
487 if (!m_readAsText) { | 487 if (!m_readAsText) { |
488 String result = base64Encode(static_cast<char*>(buffer->data()), buffer-
>byteLength()); | 488 String result = base64Encode(static_cast<char*>(buffer->data()), buffer-
>byteLength()); |
489 reportResult(static_cast<FileError::ErrorCode>(0), &result, 0); | 489 reportResult(static_cast<FileError::ErrorCode>(0), &result, 0); |
490 return; | 490 return; |
491 } | 491 } |
492 | 492 |
493 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType
, m_charset, true); | 493 OwnPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(m_mimeType
, m_charset, true); |
494 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer->
byteLength()); | 494 String result = decoder->decode(static_cast<char*>(buffer->data()), buffer->
byteLength()); |
495 result = result + decoder->flush(); | 495 result = result + decoder->flush(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 return 0; | 728 return 0; |
729 } | 729 } |
730 | 730 |
731 void InspectorFileSystemAgent::trace(Visitor* visitor) | 731 void InspectorFileSystemAgent::trace(Visitor* visitor) |
732 { | 732 { |
733 visitor->trace(m_page); | 733 visitor->trace(m_page); |
734 InspectorBaseAgent::trace(visitor); | 734 InspectorBaseAgent::trace(visitor); |
735 } | 735 } |
736 | 736 |
737 } // namespace blink | 737 } // namespace blink |
OLD | NEW |