| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC
allback, const String& url) | 211 DirectoryContentRequest(PassRefPtr<RequestDirectoryContentCallback> requestC
allback, const String& url) |
| 212 : m_requestCallback(requestCallback) | 212 : m_requestCallback(requestCallback) |
| 213 , m_url(ParsedURLString, url) { } | 213 , m_url(ParsedURLString, url) { } |
| 214 | 214 |
| 215 void readDirectoryEntries(); | 215 void readDirectoryEntries(); |
| 216 | 216 |
| 217 RefPtr<RequestDirectoryContentCallback> m_requestCallback; | 217 RefPtr<RequestDirectoryContentCallback> m_requestCallback; |
| 218 KURL m_url; | 218 KURL m_url; |
| 219 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; | 219 RefPtr<Array<TypeBuilder::FileSystem::Entry> > m_entries; |
| 220 RefPtr<DirectoryReader> m_directoryReader; | 220 RefPtrWillBePersistent<DirectoryReader> m_directoryReader; |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 void DirectoryContentRequest::start(ExecutionContext* executionContext) | 223 void DirectoryContentRequest::start(ExecutionContext* executionContext) |
| 224 { | 224 { |
| 225 ASSERT(executionContext); | 225 ASSERT(executionContext); |
| 226 | 226 |
| 227 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); | 227 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &DirectoryContentRequest::didHitError); |
| 228 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); | 228 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &DirectoryContentRequest::didGetEntry); |
| 229 | 229 |
| 230 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 230 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryVector& entries
) | 260 bool DirectoryContentRequest::didReadDirectoryEntries(const EntryVector& entries
) |
| 261 { | 261 { |
| 262 if (entries.isEmpty()) { | 262 if (entries.isEmpty()) { |
| 263 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); | 263 reportResult(static_cast<FileError::ErrorCode>(0), m_entries); |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| 267 for (size_t i = 0; i < entries.size(); ++i) { | 267 for (size_t i = 0; i < entries.size(); ++i) { |
| 268 RefPtr<Entry> entry = entries[i]; | 268 RefPtrWillBeRawPtr<Entry> entry = entries[i]; |
| 269 RefPtr<TypeBuilder::FileSystem::Entry> entryForFrontend = TypeBuilder::F
ileSystem::Entry::create() | 269 RefPtr<TypeBuilder::FileSystem::Entry> entryForFrontend = TypeBuilder::F
ileSystem::Entry::create() |
| 270 .setUrl(entry->toURL()) | 270 .setUrl(entry->toURL()) |
| 271 .setName(entry->name()) | 271 .setName(entry->name()) |
| 272 .setIsDirectory(entry->isDirectory()); | 272 .setIsDirectory(entry->isDirectory()); |
| 273 | 273 |
| 274 using TypeBuilder::Page::ResourceType; | 274 using TypeBuilder::Page::ResourceType; |
| 275 if (!entry->isDirectory()) { | 275 if (!entry->isDirectory()) { |
| 276 String mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()
); | 276 String mimeType = MIMETypeRegistry::getMIMETypeForPath(entry->name()
); |
| 277 ResourceType::Enum resourceType; | 277 ResourceType::Enum resourceType; |
| 278 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { | 278 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 , m_charset(charset) { } | 426 , m_charset(charset) { } |
| 427 | 427 |
| 428 RefPtr<RequestFileContentCallback> m_requestCallback; | 428 RefPtr<RequestFileContentCallback> m_requestCallback; |
| 429 KURL m_url; | 429 KURL m_url; |
| 430 bool m_readAsText; | 430 bool m_readAsText; |
| 431 int m_start; | 431 int m_start; |
| 432 long long m_end; | 432 long long m_end; |
| 433 String m_mimeType; | 433 String m_mimeType; |
| 434 String m_charset; | 434 String m_charset; |
| 435 | 435 |
| 436 RefPtr<FileReader> m_reader; | 436 RefPtrWillBePersistent<FileReader> m_reader; |
| 437 }; | 437 }; |
| 438 | 438 |
| 439 void FileContentRequest::start(ExecutionContext* executionContext) | 439 void FileContentRequest::start(ExecutionContext* executionContext) |
| 440 { | 440 { |
| 441 ASSERT(executionContext); | 441 ASSERT(executionContext); |
| 442 | 442 |
| 443 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &FileContentRequest::didHitError); | 443 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac
k>::create(this, &FileContentRequest::didHitError); |
| 444 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileContentRequest::didGetEntry); | 444 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb
ack>::create(this, &FileContentRequest::didGetEntry); |
| 445 | 445 |
| 446 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); | 446 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks::
create(successCallback.release(), errorCallback.release(), executionContext); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) { | 718 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree().t
raverseNext()) { |
| 719 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) | 719 if (frame->document() && frame->document()->securityOrigin()->isSameSche
meHostPort(origin)) |
| 720 return frame->document(); | 720 return frame->document(); |
| 721 } | 721 } |
| 722 | 722 |
| 723 *error = "No frame is available for the request"; | 723 *error = "No frame is available for the request"; |
| 724 return 0; | 724 return 0; |
| 725 } | 725 } |
| 726 | 726 |
| 727 } // namespace WebCore | 727 } // namespace WebCore |
| OLD | NEW |