| 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 114 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*>(WillBeHeapSupplement<LocalFrame>::f
rom(toDocument(context).frame(), supplementName())); |
| 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 |