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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 void fileSystemNotAllowed(ExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks
> callbacks) | 51 void fileSystemNotAllowed(ExecutionContext*, PassOwnPtr<AsyncFileSystemCallbacks
> callbacks) |
52 { | 52 { |
53 callbacks->didFail(FileError::ABORT_ERR); | 53 callbacks->didFail(FileError::ABORT_ERR); |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 PassOwnPtr<LocalFileSystem> LocalFileSystem::create(PassOwnPtr<FileSystemClient>
client) | 58 PassOwnPtrWillBeRawPtr<LocalFileSystem> LocalFileSystem::create(PassOwnPtr<FileS
ystemClient> client) |
59 { | 59 { |
60 return adoptPtr(new LocalFileSystem(client)); | 60 return adoptPtrWillBeNoop(new LocalFileSystem(client)); |
61 } | 61 } |
62 | 62 |
63 LocalFileSystem::~LocalFileSystem() | 63 LocalFileSystem::~LocalFileSystem() |
64 { | 64 { |
65 } | 65 } |
66 | 66 |
67 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst
emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) | 67 void LocalFileSystem::resolveURL(ExecutionContext* context, const KURL& fileSyst
emURL, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) |
68 { | 68 { |
69 if (!client() || !client()->allowFileSystem(context)) { | 69 if (!client() || !client()->allowFileSystem(context)) { |
70 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); | 70 context->postTask(createCallbackTask(&fileSystemNotAllowed, callbacks)); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
104 const char* LocalFileSystem::supplementName() | 104 const char* LocalFileSystem::supplementName() |
105 { | 105 { |
106 return "LocalFileSystem"; | 106 return "LocalFileSystem"; |
107 } | 107 } |
108 | 108 |
109 LocalFileSystem* LocalFileSystem::from(ExecutionContext& context) | 109 LocalFileSystem* LocalFileSystem::from(ExecutionContext& context) |
110 { | 110 { |
111 if (context.isDocument()) { | 111 if (context.isDocument()) { |
112 return static_cast<LocalFileSystem*>(Supplement<Page>::from(toDocument(c
ontext).page(), supplementName())); | 112 return static_cast<LocalFileSystem*>(WillBeHeapSupplement<Page>::from(to
Document(context).page(), supplementName())); |
113 } | 113 } |
114 ASSERT(context.isWorkerGlobalScope()); | 114 ASSERT(context.isWorkerGlobalScope()); |
115 return static_cast<LocalFileSystem*>(Supplement<WorkerClients>::from(toWorke
rGlobalScope(context).clients(), supplementName())); | 115 return static_cast<LocalFileSystem*>(WillBeHeapSupplement<WorkerClients>::fr
om(toWorkerGlobalScope(context).clients(), supplementName())); |
116 } | 116 } |
117 | 117 |
118 void provideLocalFileSystemTo(Page& page, PassOwnPtr<FileSystemClient> client) | 118 void provideLocalFileSystemTo(Page& page, PassOwnPtr<FileSystemClient> client) |
119 { | 119 { |
120 page.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::c
reate(client)); | 120 page.provideSupplement(LocalFileSystem::supplementName(), LocalFileSystem::c
reate(client)); |
121 page.inspectorController().registerModuleAgent(InspectorFileSystemAgent::cre
ate(&page)); | 121 page.inspectorController().registerModuleAgent(InspectorFileSystemAgent::cre
ate(&page)); |
122 } | 122 } |
123 | 123 |
124 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste
mClient> client) | 124 void provideLocalFileSystemToWorker(WorkerClients* clients, PassOwnPtr<FileSyste
mClient> client) |
125 { | 125 { |
126 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste
m::create(client)); | 126 clients->provideSupplement(LocalFileSystem::supplementName(), LocalFileSyste
m::create(client)); |
127 } | 127 } |
128 | 128 |
129 } // namespace WebCore | 129 } // namespace WebCore |
OLD | NEW |