OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC
allback, const String& url) | 210 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC
allback, const String& url) |
211 : m_requestCallback(requestCallback) | 211 : m_requestCallback(requestCallback) |
212 , m_url(ParsedURLString, url) { } | 212 , m_url(ParsedURLString, url) { } |
213 | 213 |
214 void readDirectoryEntries(); | 214 void readDirectoryEntries(); |
215 | 215 |
216 RefPtr<RequestDirectoryContentCallback> m_requestCallback; | 216 RefPtr<RequestDirectoryContentCallback> m_requestCallback; |
217 KURL m_url; | 217 KURL m_url; |
218 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; | 218 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; |
219 RefPtrWillBePersistent<DirectoryReader> m_directoryReader; | 219 Persistent<DirectoryReader> m_directoryReader; |
220 }; | 220 }; |
221 | 221 |
222 void DirectoryContentRequest::start(ExecutionContext* executionContext) | 222 void DirectoryContentRequest::start(ExecutionContext* executionContext) |
223 { | 223 { |
224 ASSERT(executionContext); | 224 ASSERT(executionContext); |
225 | 225 |
226 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); | 226 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); |
227 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); | 227 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); |
228 | 228 |
229 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 229 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); |
(...skipping 27 matching lines...) Expand all Loading... |
257 } | 257 } |
258 | 258 |
259 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryHeapVector& ent
ries) | 259 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryHeapVector& ent
ries) |
260 { | 260 { |
261 if (entries.isEmpty()) { | 261 if (entries.isEmpty()) { |
262 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); | 262 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); |
263 return true; | 263 return true; |
264 } | 264 } |
265 | 265 |
266 for (size_t i = 0; i < entries.size(); ++i) { | 266 for (size_t i = 0; i < entries.size(); ++i) { |
267 RefPtrWillBeRawPtr<Entry> entry = entries[i]; | 267 Entry* entry = entries[i]; |
268 RefPtr<TypeBuilder::FileSystem::Entry> entryForFrontend = TypeBuilder::F
ileSystem::Entry::create() | 268 RefPtr<TypeBuilder::FileSystem::Entry> entryForFrontend = TypeBuilder::F
ileSystem::Entry::create() |
269 .setUrl(entry->toURL()) | 269 .setUrl(entry->toURL()) |
270 .setName(entry->name()) | 270 .setName(entry->name()) |
271 .setIsDirectory(entry->isDirectory()); | 271 .setIsDirectory(entry->isDirectory()); |
272 | 272 |
273 using TypeBuilder::Page::ResourceType; | 273 using TypeBuilder::Page::ResourceType; |
274 if (!entry->isDirectory()) { | 274 if (!entry->isDirectory()) { |
275 String mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()
); | 275 String mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()
); |
276 ResourceType::Enum resourceType; | 276 ResourceType::Enum resourceType; |
277 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { | 277 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 LocalFrame* localFrame = toLocalFrame(frame); | 720 LocalFrame* localFrame = toLocalFrame(frame); |
721 if (localFrame->document() && localFrame->document()->securityOrigin()->
isSameSchemeHostPort(origin)) | 721 if (localFrame->document() && localFrame->document()->securityOrigin()->
isSameSchemeHostPort(origin)) |
722 return localFrame->document(); | 722 return localFrame->document(); |
723 } | 723 } |
724 | 724 |
725 *error = "No frame is available for the request"; | 725 *error = "No frame is available for the request"; |
726 return 0; | 726 return 0; |
727 } | 727 } |
728 | 728 |
729 } // namespace WebCore | 729 } // namespace WebCore |
OLD | NEW |