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

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

Issue 2582463002: Fix webkitGetEntry for non-native files. (Closed)
Patch Set: . Created 4 years 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 21 matching lines...) Expand all
32 32
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "modules/filesystem/DOMFileSystem.h" 34 #include "modules/filesystem/DOMFileSystem.h"
35 #include "platform/Supplementable.h" 35 #include "platform/Supplementable.h"
36 #include "platform/weborigin/SecurityOrigin.h" 36 #include "platform/weborigin/SecurityOrigin.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 DOMFileSystem* DraggedIsolatedFileSystemImpl::getDOMFileSystem( 40 DOMFileSystem* DraggedIsolatedFileSystemImpl::getDOMFileSystem(
41 DataObject* host, 41 DataObject* host,
42 ExecutionContext* executionContext) { 42 ExecutionContext* executionContext,
43 const DataObjectItem& item) {
44 if (!item.hasFileSystemId())
45 return nullptr;
46 const String fileSystemId = item.fileSystemId();
43 DraggedIsolatedFileSystemImpl* draggedIsolatedFileSystem = from(host); 47 DraggedIsolatedFileSystemImpl* draggedIsolatedFileSystem = from(host);
44 if (!draggedIsolatedFileSystem) 48 if (!draggedIsolatedFileSystem)
45 return 0; 49 return nullptr;
46 if (!draggedIsolatedFileSystem->m_filesystem) 50 auto it = draggedIsolatedFileSystem->m_filesystems.find(fileSystemId);
47 draggedIsolatedFileSystem->m_filesystem = 51 if (it != draggedIsolatedFileSystem->m_filesystems.end())
48 DOMFileSystem::createIsolatedFileSystem(executionContext, 52 return it->value;
49 host->filesystemId()); 53 return draggedIsolatedFileSystem->m_filesystems
50 return draggedIsolatedFileSystem->m_filesystem.get(); 54 .add(fileSystemId, DOMFileSystem::createIsolatedFileSystem(
55 executionContext, fileSystemId))
56 .storedValue->value;
51 } 57 }
52 58
53 // static 59 // static
54 const char* DraggedIsolatedFileSystemImpl::supplementName() { 60 const char* DraggedIsolatedFileSystemImpl::supplementName() {
55 ASSERT(isMainThread()); 61 ASSERT(isMainThread());
56 return "DraggedIsolatedFileSystemImpl"; 62 return "DraggedIsolatedFileSystemImpl";
57 } 63 }
58 64
59 DraggedIsolatedFileSystemImpl* DraggedIsolatedFileSystemImpl::from( 65 DraggedIsolatedFileSystemImpl* DraggedIsolatedFileSystemImpl::from(
60 DataObject* dataObject) { 66 DataObject* dataObject) {
61 return static_cast<DraggedIsolatedFileSystemImpl*>( 67 return static_cast<DraggedIsolatedFileSystemImpl*>(
62 Supplement<DataObject>::from(dataObject, supplementName())); 68 Supplement<DataObject>::from(dataObject, supplementName()));
63 } 69 }
64 70
65 DraggedIsolatedFileSystemImpl::DraggedIsolatedFileSystemImpl(
66 DataObject& host,
67 const String& filesystemId) {
68 host.setFilesystemId(filesystemId);
69 }
70
71 DEFINE_TRACE(DraggedIsolatedFileSystemImpl) { 71 DEFINE_TRACE(DraggedIsolatedFileSystemImpl) {
72 visitor->trace(m_filesystem); 72 visitor->trace(m_filesystems);
73 Supplement<DataObject>::trace(visitor); 73 Supplement<DataObject>::trace(visitor);
74 } 74 }
75 75
76 void DraggedIsolatedFileSystemImpl::prepareForDataObject( 76 void DraggedIsolatedFileSystemImpl::prepareForDataObject(
77 DataObject* dataObject, 77 DataObject* dataObject) {
78 const String& filesystemId) { 78 DraggedIsolatedFileSystemImpl* fileSystem =
79 DraggedIsolatedFileSystemImpl* fileSystem = create(*dataObject, filesystemId); 79 new DraggedIsolatedFileSystemImpl();
80 DraggedIsolatedFileSystemImpl::provideTo( 80 DraggedIsolatedFileSystemImpl::provideTo(
81 *dataObject, DraggedIsolatedFileSystemImpl::supplementName(), fileSystem); 81 *dataObject, DraggedIsolatedFileSystemImpl::supplementName(), fileSystem);
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698