Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.cpp

Issue 2610903002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 "modules/filesystem/HTMLInputElementFileSystem.h" 31 #include "modules/filesystem/HTMLInputElementFileSystem.h"
32 32
33 #include "bindings/core/v8/ScriptState.h"
33 #include "core/fileapi/FileList.h" 34 #include "core/fileapi/FileList.h"
34 #include "core/html/HTMLInputElement.h" 35 #include "core/html/HTMLInputElement.h"
35 #include "modules/filesystem/DOMFilePath.h" 36 #include "modules/filesystem/DOMFilePath.h"
36 #include "modules/filesystem/DOMFileSystem.h" 37 #include "modules/filesystem/DOMFileSystem.h"
37 #include "modules/filesystem/DirectoryEntry.h" 38 #include "modules/filesystem/DirectoryEntry.h"
38 #include "modules/filesystem/Entry.h" 39 #include "modules/filesystem/Entry.h"
39 #include "modules/filesystem/FileEntry.h" 40 #include "modules/filesystem/FileEntry.h"
40 #include "platform/FileMetadata.h" 41 #include "platform/FileMetadata.h"
41 #include "platform/heap/Handle.h" 42 #include "platform/heap/Handle.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 // static 46 // static
46 EntryHeapVector HTMLInputElementFileSystem::webkitEntries( 47 EntryHeapVector HTMLInputElementFileSystem::webkitEntries(
47 ExecutionContext* executionContext, 48 ScriptState* scriptState,
48 HTMLInputElement& input) { 49 HTMLInputElement& input) {
49 EntryHeapVector entries; 50 EntryHeapVector entries;
50 FileList* files = input.files(); 51 FileList* files = input.files();
51 52
52 if (!files) 53 if (!files)
53 return entries; 54 return entries;
54 55
55 DOMFileSystem* filesystem = DOMFileSystem::createIsolatedFileSystem( 56 DOMFileSystem* filesystem = DOMFileSystem::createIsolatedFileSystem(
56 executionContext, input.droppedFileSystemId()); 57 scriptState->getExecutionContext(), input.droppedFileSystemId());
57 if (!filesystem) { 58 if (!filesystem) {
58 // Drag-drop isolated filesystem is not available. 59 // Drag-drop isolated filesystem is not available.
59 return entries; 60 return entries;
60 } 61 }
61 62
62 for (unsigned i = 0; i < files->length(); ++i) { 63 for (unsigned i = 0; i < files->length(); ++i) {
63 File* file = files->item(i); 64 File* file = files->item(i);
64 65
65 // FIXME: This involves synchronous file operation. 66 // FIXME: This involves synchronous file operation.
66 FileMetadata metadata; 67 FileMetadata metadata;
67 if (!getFileMetadata(file->path(), metadata)) 68 if (!getFileMetadata(file->path(), metadata))
68 continue; 69 continue;
69 70
70 // The dropped entries are mapped as top-level entries in the isolated 71 // The dropped entries are mapped as top-level entries in the isolated
71 // filesystem. 72 // filesystem.
72 String virtualPath = DOMFilePath::append("/", file->name()); 73 String virtualPath = DOMFilePath::append("/", file->name());
73 if (metadata.type == FileMetadata::TypeDirectory) 74 if (metadata.type == FileMetadata::TypeDirectory)
74 entries.append(DirectoryEntry::create(filesystem, virtualPath)); 75 entries.append(DirectoryEntry::create(filesystem, virtualPath));
75 else 76 else
76 entries.append(FileEntry::create(filesystem, virtualPath)); 77 entries.append(FileEntry::create(filesystem, virtualPath));
77 } 78 }
78 return entries; 79 return entries;
79 } 80 }
80 81
81 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698