Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/filesystem/LocalFileSystem.h" | 32 #include "modules/filesystem/LocalFileSystem.h" |
| 33 | 33 |
| 34 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/fileapi/FileError.h" | 38 #include "core/fileapi/FileError.h" |
| 39 #include "core/inspector/InspectorController.h" | 39 #include "core/frame/LocalFrame.h" |
| 40 #include "core/workers/WorkerGlobalScope.h" | 40 #include "core/workers/WorkerGlobalScope.h" |
| 41 #include "modules/filesystem/FileSystemClient.h" | 41 #include "modules/filesystem/FileSystemClient.h" |
| 42 #include "modules/filesystem/InspectorFileSystemAgent.h" | |
| 43 #include "platform/AsyncFileSystemCallbacks.h" | 42 #include "platform/AsyncFileSystemCallbacks.h" |
| 44 #include "platform/PermissionCallbacks.h" | 43 #include "platform/PermissionCallbacks.h" |
| 45 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
| 46 #include "public/platform/WebFileSystem.h" | 45 #include "public/platform/WebFileSystem.h" |
| 47 #include "wtf/Functional.h" | 46 #include "wtf/Functional.h" |
| 48 #include "wtf/RefCounted.h" | 47 #include "wtf/RefCounted.h" |
| 49 | 48 |
| 50 namespace WebCore { | 49 namespace WebCore { |
| 51 | 50 |
| 52 namespace { | 51 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 67 virtual ~CallbackWrapper() { } | 66 virtual ~CallbackWrapper() { } |
| 68 PassOwnPtr<AsyncFileSystemCallbacks> release() | 67 PassOwnPtr<AsyncFileSystemCallbacks> release() |
| 69 { | 68 { |
| 70 return m_callbacks.release(); | 69 return m_callbacks.release(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 private: | 72 private: |
| 74 OwnPtr<AsyncFileSystemCallbacks> m_callbacks; | 73 OwnPtr<AsyncFileSystemCallbacks> m_callbacks; |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 PassOwnPtrWillBeRawPtr<LocalFileSystem> LocalFileSystem::create(PassOwnPtr<FileS ystemClient> client) | 76 PassOwnPtr<LocalFileSystem> LocalFileSystem::create(PassOwnPtr<FileSystemClient> client) |
|
zerny-chromium
2014/06/10 11:39:59
revert
| |
| 78 { | 77 { |
| 79 return adoptPtrWillBeNoop(new LocalFileSystem(client)); | 78 return adoptPtr(new LocalFileSystem(client)); |
|
zerny-chromium
2014/06/10 11:39:59
revert
| |
| 80 } | 79 } |
| 81 | 80 |
| 82 LocalFileSystem::~LocalFileSystem() | 81 LocalFileSystem::~LocalFileSystem() |
| 83 { | 82 { |
| 84 } | 83 } |
| 85 | 84 |
| 86 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 85 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
| 87 { | 86 { |
| 88 RefPtr<CallbackWrapper> wrapper = adoptRef(new CallbackWrapper(callbacks)); | 87 RefPtr<CallbackWrapper> wrapper = adoptRef(new CallbackWrapper(callbacks)); |
| 89 requestFileSystemAccessInternal(context, | 88 requestFileSystemAccessInternal(context, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 } | 166 } |
| 168 | 167 |
| 169 const char* LocalFileSystem::supplementName() | 168 const char* LocalFileSystem::supplementName() |
| 170 { | 169 { |
| 171 return "LocalFileSystem"; | 170 return "LocalFileSystem"; |
| 172 } | 171 } |
| 173 | 172 |
| 174 LocalFileSystem* LocalFileSystem::from(ExecutionContext& context) | 173 LocalFileSystem* LocalFileSystem::from(ExecutionContext& context) |
| 175 { | 174 { |
| 176 if (context.isDocument()) { | 175 if (context.isDocument()) { |
| 177 return static_cast<LocalFileSystem*>(WillBeHeapSupplement<Page>::from(to Document(context).page(), supplementName())); | 176 return static_cast<LocalFileSystem*>(Supplement<LocalFrame>::from(toDocu ment(context).frame(), supplementName())); |
|
zerny-chromium
2014/06/10 11:39:59
WillBeHeapSupplement<LocalFrame>
| |
| 178 } | 177 } |
| 179 ASSERT(context.isWorkerGlobalScope()); | 178 ASSERT(context.isWorkerGlobalScope()); |
| 180 return static_cast<LocalFileSystem*>(WillBeHeapSupplement<WorkerClients>::fr om(toWorkerGlobalScope(context).clients(), supplementName())); | 179 return static_cast<LocalFileSystem*>(WillBeHeapSupplement<WorkerClients>::fr om(toWorkerGlobalScope(context).clients(), supplementName())); |
| 181 } | 180 } |
| 182 | 181 |
| 183 void provideLocalFileSystemTo(Page& page, PassOwnPtr<FileSystemClient> client) | 182 void provideLocalFileSystemTo(LocalFrame& frame, PassOwnPtr<FileSystemClient> cl ient) |
| 184 { | 183 { |
| 185 page.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::c reate(client)); | 184 frame.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem:: create(client)); |
| 186 page.inspectorController().registerModuleAgent(InspectorFileSystemAgent::cre ate(&page)); | |
| 187 } | 185 } |
| 188 | 186 |
| 189 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste mClient> client) | 187 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste mClient> client) |
| 190 { | 188 { |
| 191 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste m::create(client)); | 189 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste m::create(client)); |
| 192 } | 190 } |
| 193 | 191 |
| 194 } // namespace WebCore | 192 } // namespace WebCore |
| OLD | NEW |