Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: Source/modules/filesystem/InspectorFileSystemAgent.cpp

Issue 171333003: Pass implementation object to supplemental classes by reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 KURL rootURL = DOMFileSystemBase::createFileSystemRootURL(executionContext-> securityOrigin()->toString(), type); 159 KURL rootURL = DOMFileSystemBase::createFileSystemRootURL(executionContext-> securityOrigin()->toString(), type);
160 if (!rootURL.isValid()) { 160 if (!rootURL.isValid()) {
161 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get( )); 161 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get( ));
162 return; 162 return;
163 } 163 }
164 164
165 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &FileSystemRootRequest::didGetEntry); 165 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &FileSystemRootRequest::didGetEntry);
166 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext); 166 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext);
167 LocalFileSystem::from(executionContext)->resolveURL(executionContext, rootUR L, fileSystemCallbacks.release()); 167 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, rootU RL, fileSystemCallbacks.release());
168 } 168 }
169 169
170 bool FileSystemRootRequest::didGetEntry(Entry* entry) 170 bool FileSystemRootRequest::didGetEntry(Entry* entry)
171 { 171 {
172 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create() 172 RefPtr<TypeBuilder::FileSystem::Entry> result = TypeBuilder::FileSystem::Ent ry::create()
173 .setUrl(entry->toURL()) 173 .setUrl(entry->toURL())
174 .setName("/") 174 .setName("/")
175 .setIsDirectory(true); 175 .setIsDirectory(true);
176 reportResult(static_cast<FileError::ErrorCode>(0), result); 176 reportResult(static_cast<FileError::ErrorCode>(0), result);
177 return true; 177 return true;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
230 230
231 LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release()); 231 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url , fileSystemCallbacks.release());
232 } 232 }
233 233
234 bool DirectoryContentRequest::didGetEntry(Entry* entry) 234 bool DirectoryContentRequest::didGetEntry(Entry* entry)
235 { 235 {
236 if (!entry->isDirectory()) { 236 if (!entry->isDirectory()) {
237 reportResult(FileError::TYPE_MISMATCH_ERR); 237 reportResult(FileError::TYPE_MISMATCH_ERR);
238 return true; 238 return true;
239 } 239 }
240 240
241 m_directoryReader = toDirectoryEntry(entry)->createReader(); 241 m_directoryReader = toDirectoryEntry(entry)->createReader();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 bool m_isDirectory; 337 bool m_isDirectory;
338 }; 338 };
339 339
340 void MetadataRequest::start(ExecutionContext* executionContext) 340 void MetadataRequest::start(ExecutionContext* executionContext)
341 { 341 {
342 ASSERT(executionContext); 342 ASSERT(executionContext);
343 343
344 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &MetadataRequest::didHitError); 344 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &MetadataRequest::didHitError);
345 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &MetadataRequest::didGetEntry); 345 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &MetadataRequest::didGetEntry);
346 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext); 346 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext);
347 LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release()); 347 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url , fileSystemCallbacks.release());
348 } 348 }
349 349
350 bool MetadataRequest::didGetEntry(Entry* entry) 350 bool MetadataRequest::didGetEntry(Entry* entry)
351 { 351 {
352 if (!entry->filesystem()->executionContext()) { 352 if (!entry->filesystem()->executionContext()) {
353 reportResult(FileError::ABORT_ERR); 353 reportResult(FileError::ABORT_ERR);
354 return true; 354 return true;
355 } 355 }
356 356
357 OwnPtr<MetadataCallback> successCallback = CallbackDispatcherFactory<Metadat aCallback>::create(this, &MetadataRequest::didGetMetadata); 357 OwnPtr<MetadataCallback> successCallback = CallbackDispatcherFactory<Metadat aCallback>::create(this, &MetadataRequest::didGetMetadata);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 }; 436 };
437 437
438 void FileContentRequest::start(ExecutionContext* executionContext) 438 void FileContentRequest::start(ExecutionContext* executionContext)
439 { 439 {
440 ASSERT(executionContext); 440 ASSERT(executionContext);
441 441
442 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &FileContentRequest::didHitError); 442 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &FileContentRequest::didHitError);
443 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &FileContentRequest::didGetEntry); 443 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryCallb ack>::create(this, &FileContentRequest::didGetEntry);
444 444
445 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext); 445 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbacks:: create(successCallback.release(), errorCallback.release(), executionContext);
446 LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_url, fileSystemCallbacks.release()); 446 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m_url , fileSystemCallbacks.release());
447 } 447 }
448 448
449 bool FileContentRequest::didGetEntry(Entry* entry) 449 bool FileContentRequest::didGetEntry(Entry* entry)
450 { 450 {
451 if (entry->isDirectory()) { 451 if (entry->isDirectory()) {
452 reportResult(FileError::TYPE_MISMATCH_ERR); 452 reportResult(FileError::TYPE_MISMATCH_ERR);
453 return true; 453 return true;
454 } 454 }
455 455
456 if (!entry->filesystem()->executionContext()) { 456 if (!entry->filesystem()->executionContext()) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 FileSystemType type; 558 FileSystemType type;
559 String path; 559 String path;
560 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) { 560 if (!DOMFileSystemBase::crackFileSystemURL(m_url, type, path)) {
561 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get( )); 561 errorCallback->handleEvent(FileError::create(FileError::SYNTAX_ERR).get( ));
562 return; 562 return;
563 } 563 }
564 564
565 if (path == "/") { 565 if (path == "/") {
566 OwnPtr<VoidCallback> successCallback = adoptPtr(new VoidCallbackImpl(thi s)); 566 OwnPtr<VoidCallback> successCallback = adoptPtr(new VoidCallbackImpl(thi s));
567 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr eate(successCallback.release(), errorCallback.release(), 0); 567 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = VoidCallbacks::cr eate(successCallback.release(), errorCallback.release(), 0);
568 LocalFileSystem::from(executionContext)->deleteFileSystem(executionConte xt, type, fileSystemCallbacks.release()); 568 LocalFileSystem::from(*executionContext)->deleteFileSystem(executionCont ext, type, fileSystemCallbacks.release());
569 } else { 569 } else {
570 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryC allback>::create(this, &DeleteEntryRequest::didGetEntry); 570 OwnPtr<EntryCallback> successCallback = CallbackDispatcherFactory<EntryC allback>::create(this, &DeleteEntryRequest::didGetEntry);
571 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbac ks::create(successCallback.release(), errorCallback.release(), executionContext) ; 571 OwnPtr<AsyncFileSystemCallbacks> fileSystemCallbacks = ResolveURICallbac ks::create(successCallback.release(), errorCallback.release(), executionContext) ;
572 LocalFileSystem::from(executionContext)->resolveURL(executionContext, m_ url, fileSystemCallbacks.release()); 572 LocalFileSystem::from(*executionContext)->resolveURL(executionContext, m _url, fileSystemCallbacks.release());
573 } 573 }
574 } 574 }
575 575
576 bool DeleteEntryRequest::didGetEntry(Entry* entry) 576 bool DeleteEntryRequest::didGetEntry(Entry* entry)
577 { 577 {
578 OwnPtr<VoidCallback> successCallback = adoptPtr(new VoidCallbackImpl(this)); 578 OwnPtr<VoidCallback> successCallback = adoptPtr(new VoidCallbackImpl(this));
579 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &DeleteEntryRequest::didHitError); 579 OwnPtr<ErrorCallback> errorCallback = CallbackDispatcherFactory<ErrorCallbac k>::create(this, &DeleteEntryRequest::didHitError);
580 if (entry->isDirectory()) { 580 if (entry->isDirectory()) {
581 DirectoryEntry* directoryEntry = toDirectoryEntry(entry); 581 DirectoryEntry* directoryEntry = toDirectoryEntry(entry);
582 directoryEntry->removeRecursively(successCallback.release(), errorCallba ck.release()); 582 directoryEntry->removeRecursively(successCallback.release(), errorCallba ck.release());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 717 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
718 if (frame->document() && frame->document()->securityOrigin()->isSameSche meHostPort(origin)) 718 if (frame->document() && frame->document()->securityOrigin()->isSameSche meHostPort(origin))
719 return frame->document(); 719 return frame->document();
720 } 720 }
721 721
722 *error = "No frame is available for the request"; 722 *error = "No frame is available for the request";
723 return 0; 723 return 0;
724 } 724 }
725 725
726 } // namespace WebCore 726 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698