Changeset 108556 in webkit


Ignore:
Timestamp:
Feb 22, 2012 3:07:26 PM (12 years ago)
Author:
abarth@webkit.org
Message:

Move FILE_SYSTEM code out of DOMWindow and into the fileapi folder
https://bugs.webkit.org/show_bug.cgi?id=79259

Reviewed by Eric Seidel.

This patch is part of our ongoing effort to remove ifdefs from code
classes. The FILE_SYSTEM code in DOMWindow doesn't really have any
necessary connection to DOMWindow. DOMWindow is just the context
object that the API hangs off of.

This patch moves the FILE_SYSTEM code into the fileapi folder using
[Supplemental].

  • CMakeLists.txt:
  • DerivedSources.make:
  • DerivedSources.pri:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • fileapi/DOMWindowFileSystem.cpp: Added.

(WebCore):
(WebCore::DOMWindowFileSystem::DOMWindowFileSystem):
(WebCore::DOMWindowFileSystem::~DOMWindowFileSystem):
(WebCore::DOMWindowFileSystem::webkitRequestFileSystem):
(WebCore::DOMWindowFileSystem::webkitResolveLocalFileSystemURL):

  • fileapi/DOMWindowFileSystem.h: Added.

(WebCore):
(DOMWindowFileSystem):

  • fileapi/DOMWindowFileSystem.idl: Added.
  • page/DOMWindow.cpp:

(WebCore):

  • page/DOMWindow.h:

(WebCore):
(DOMWindow):

  • page/DOMWindow.idl:
Location:
trunk/Source/WebCore
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r108476 r108556  
    16021602        fileapi/DOMFileSystemBase.cpp
    16031603        fileapi/DOMFileSystemSync.cpp
     1604        fileapi/DOMWindowFileSystem.cpp
    16041605        fileapi/Entry.cpp
    16051606        fileapi/EntryArray.cpp
     
    16231624        fileapi/DOMFileSystem.idl
    16241625        fileapi/DOMFileSystemSync.idl
     1626        fileapi/DOMWindowFileSystem.idl
    16251627        fileapi/EntriesCallback.idl
    16261628        fileapi/Entry.idl
  • trunk/Source/WebCore/ChangeLog

    r108555 r108556  
     12012-02-22  Adam Barth  <abarth@webkit.org>
     2
     3        Move FILE_SYSTEM code out of DOMWindow and into the fileapi folder
     4        https://bugs.webkit.org/show_bug.cgi?id=79259
     5
     6        Reviewed by Eric Seidel.
     7
     8        This patch is part of our ongoing effort to remove ifdefs from code
     9        classes.  The FILE_SYSTEM code in DOMWindow doesn't really have any
     10        necessary connection to DOMWindow.  DOMWindow is just the context
     11        object that the API hangs off of.
     12
     13        This patch moves the FILE_SYSTEM code into the fileapi folder using
     14        [Supplemental].
     15
     16        * CMakeLists.txt:
     17        * DerivedSources.make:
     18        * DerivedSources.pri:
     19        * GNUmakefile.list.am:
     20        * Target.pri:
     21        * WebCore.gypi:
     22        * fileapi/DOMWindowFileSystem.cpp: Added.
     23        (WebCore):
     24        (WebCore::DOMWindowFileSystem::DOMWindowFileSystem):
     25        (WebCore::DOMWindowFileSystem::~DOMWindowFileSystem):
     26        (WebCore::DOMWindowFileSystem::webkitRequestFileSystem):
     27        (WebCore::DOMWindowFileSystem::webkitResolveLocalFileSystemURL):
     28        * fileapi/DOMWindowFileSystem.h: Added.
     29        (WebCore):
     30        (DOMWindowFileSystem):
     31        * fileapi/DOMWindowFileSystem.idl: Added.
     32        * page/DOMWindow.cpp:
     33        (WebCore):
     34        * page/DOMWindow.h:
     35        (WebCore):
     36        (DOMWindow):
     37        * page/DOMWindow.idl:
     38
    1392012-02-22  Luke Macpherson   <macpherson@chromium.org>
    240
  • trunk/Source/WebCore/DerivedSources.make

    r108464 r108556  
    159159    $(WebCore)/fileapi/DOMFileSystem.idl \
    160160    $(WebCore)/fileapi/DOMFileSystemSync.idl \
     161    $(WebCore)/fileapi/DOMWindowFileSystem.idl \
    161162    $(WebCore)/fileapi/DirectoryEntry.idl \
    162163    $(WebCore)/fileapi/DirectoryEntrySync.idl \
  • trunk/Source/WebCore/DerivedSources.pri

    r108464 r108556  
    190190    $$PWD/fileapi/DOMFileSystem.idl \
    191191    $$PWD/fileapi/DOMFileSystemSync.idl \
     192    $$PWD/fileapi/DOMWindowFileSystem.idl \
    192193    $$PWD/fileapi/EntriesCallback.idl \
    193194    $$PWD/fileapi/Entry.idl \
  • trunk/Source/WebCore/GNUmakefile.list.am

    r108476 r108556  
    18741874        Source/WebCore/fileapi/DOMFileSystemSync.cpp \
    18751875        Source/WebCore/fileapi/DOMFileSystemSync.h \
     1876        Source/WebCore/fileapi/DOMWindowFileSystem.cpp \
     1877        Source/WebCore/fileapi/DOMWindowFileSystem.h \
    18761878        Source/WebCore/fileapi/EntriesCallback.h \
    18771879        Source/WebCore/fileapi/Entry.cpp \
     
    48344836        $(WebCore)/fileapi/DOMFileSystem.idl \
    48354837        $(WebCore)/fileapi/DOMFileSystemSync.idl \
     4838        $(WebCore)/fileapi/DOMWindowFileSystem.idl \
    48364839        $(WebCore)/fileapi/DirectoryEntry.idl \
    48374840        $(WebCore)/fileapi/DirectoryEntrySync.idl \
  • trunk/Source/WebCore/Target.pri

    r108498 r108556  
    657657    fileapi/DOMFileSystemBase.cpp \
    658658    fileapi/DOMFileSystemSync.cpp \
     659    fileapi/DOMWindowFileSystem.cpp \
    659660    fileapi/DirectoryEntry.cpp \
    660661    fileapi/DirectoryEntrySync.cpp \
  • trunk/Source/WebCore/WebCore.gypi

    r108532 r108556  
    833833            'fileapi/DOMFileSystem.idl',
    834834            'fileapi/DOMFileSystemSync.idl',
     835            'fileapi/DOMWindowFileSystem.idl',
    835836            'fileapi/EntriesCallback.idl',
    836837            'fileapi/Entry.idl',
     
    22332234            'fileapi/DOMFileSystemSync.cpp',
    22342235            'fileapi/DOMFileSystemSync.h',
     2236            'fileapi/DOMWindowFileSystem.cpp',
     2237            'fileapi/DOMWindowFileSystem.h',
    22352238            'fileapi/DirectoryEntry.cpp',
    22362239            'fileapi/DirectoryEntry.h',
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r108428 r108556  
    103103#include <wtf/text/WTFString.h>
    104104
    105 #if ENABLE(FILE_SYSTEM)
    106 #include "AsyncFileSystem.h"
    107 #include "DOMFileSystem.h"
    108 #include "EntryCallback.h"
    109 #include "ErrorCallback.h"
    110 #include "FileError.h"
    111 #include "FileSystemCallback.h"
    112 #include "FileSystemCallbacks.h"
    113 #include "LocalFileSystem.h"
    114 #endif
    115 
    116105#if ENABLE(REQUEST_ANIMATION_FRAME)
    117106#include "RequestAnimationFrameCallback.h"
     
    754743#endif
    755744
    756 #if ENABLE(FILE_SYSTEM)
    757 void DOMWindow::webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    758 {
    759     if (!isCurrentlyDisplayedInFrame())
    760         return;
    761 
    762     Document* document = this->document();
    763     if (!document)
    764         return;
    765 
    766     if (!AsyncFileSystem::isAvailable() || !document->securityOrigin()->canAccessFileSystem()) {
    767         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::SECURITY_ERR));
    768         return;
    769     }
    770 
    771     AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);
    772     if (!AsyncFileSystem::isValidType(fileSystemType)) {
    773         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR));
    774         return;
    775     }
    776 
    777     LocalFileSystem::localFileSystem().requestFileSystem(document, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, document), false);
    778 }
    779 
    780 void DOMWindow::webkitResolveLocalFileSystemURL(const String& url, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
    781 {
    782     if (!isCurrentlyDisplayedInFrame())
    783         return;
    784 
    785     Document* document = this->document();
    786     if (!document)
    787         return;
    788 
    789     SecurityOrigin* securityOrigin = document->securityOrigin();
    790     KURL completedURL = document->completeURL(url);
    791     if (!AsyncFileSystem::isAvailable() || !securityOrigin->canAccessFileSystem() || !securityOrigin->canRequest(completedURL)) {
    792         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::SECURITY_ERR));
    793         return;
    794     }
    795 
    796     AsyncFileSystem::Type type;
    797     String filePath;
    798     if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) {
    799         DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::ENCODING_ERR));
    800         return;
    801     }
    802 
    803     LocalFileSystem::localFileSystem().readFileSystem(document, type, ResolveURICallbacks::create(successCallback, errorCallback, document, filePath));
    804 }
    805 
    806 COMPILE_ASSERT(static_cast<int>(DOMWindow::TEMPORARY) == static_cast<int>(AsyncFileSystem::Temporary), enum_mismatch);
    807 COMPILE_ASSERT(static_cast<int>(DOMWindow::PERSISTENT) == static_cast<int>(AsyncFileSystem::Persistent), enum_mismatch);
    808 
    809 #endif
    810 
    811745void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec)
    812746{
  • trunk/Source/WebCore/page/DOMWindow.h

    r108428 r108556  
    4747    class Document;
    4848    class Element;
    49     class EntryCallback;
    50     class ErrorCallback;
    5149    class EventListener;
    52     class FileSystemCallback;
    5350    class FloatRect;
    5451    class Frame;
     
    359356        // They are placed here and in all capital letters so they can be checked against the constants in the
    360357        // IDL at compile time.
     358        // FIXME: Move these constants to DOMWindowFileSystem.
    361359        enum FileSystemType {
    362360            TEMPORARY,
    363361            PERSISTENT,
    364362        };
    365         void webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>);
    366         void webkitResolveLocalFileSystemURL(const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
    367363#endif
    368364
  • trunk/Source/WebCore/page/DOMWindow.idl

    r108301 r108556  
    173173#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
    174174        readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications;
    175 #endif
    176 #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM
    177         const unsigned short TEMPORARY = 0;
    178         const unsigned short PERSISTENT = 1;
    179         [V8EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback);
    180         [V8EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback);
    181175#endif
    182176
Note: See TracChangeset for help on using the changeset viewer.