| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 PassRefPtr<EntrySync> EntrySync::create(EntryBase* entry) | 46 PassRefPtr<EntrySync> EntrySync::create(EntryBase* entry) |
| 47 { | 47 { |
| 48 if (entry->isFile()) | 48 if (entry->isFile()) |
| 49 return adoptRef(new FileEntrySync(entry->m_fileSystem, entry->m_fullPath
)); | 49 return adoptRef(new FileEntrySync(entry->m_fileSystem, entry->m_fullPath
)); |
| 50 return adoptRef(new DirectoryEntrySync(entry->m_fileSystem, entry->m_fullPat
h)); | 50 return adoptRef(new DirectoryEntrySync(entry->m_fileSystem, entry->m_fullPat
h)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassRefPtr<Metadata> EntrySync::getMetadata(ExceptionState& es) | 53 PassRefPtr<Metadata> EntrySync::getMetadata(ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 MetadataSyncCallbackHelper helper; | 55 MetadataSyncCallbackHelper helper; |
| 56 if (!m_fileSystem->getMetadata(this, helper.successCallback(), helper.errorC
allback(), DOMFileSystemBase::Synchronous)) { | 56 if (!m_fileSystem->getMetadata(this, helper.successCallback(), helper.errorC
allback(), DOMFileSystemBase::Synchronous)) { |
| 57 es.throwDOMException(InvalidModificationError, ExceptionMessages::failed
ToExecute("getMetadata", "EntrySync")); | 57 exceptionState.throwDOMException(InvalidModificationError, ExceptionMess
ages::failedToExecute("getMetadata", "EntrySync")); |
| 58 return 0; | 58 return 0; |
| 59 } | 59 } |
| 60 return helper.getResult(es); | 60 return helper.getResult(exceptionState); |
| 61 } | 61 } |
| 62 | 62 |
| 63 PassRefPtr<EntrySync> EntrySync::moveTo(PassRefPtr<DirectoryEntrySync> parent, c
onst String& name, ExceptionState& es) const | 63 PassRefPtr<EntrySync> EntrySync::moveTo(PassRefPtr<DirectoryEntrySync> parent, c
onst String& name, ExceptionState& exceptionState) const |
| 64 { | 64 { |
| 65 EntrySyncCallbackHelper helper; | 65 EntrySyncCallbackHelper helper; |
| 66 if (!m_fileSystem->move(this, parent.get(), name, helper.successCallback(),
helper.errorCallback(), DOMFileSystemBase::Synchronous)) { | 66 if (!m_fileSystem->move(this, parent.get(), name, helper.successCallback(),
helper.errorCallback(), DOMFileSystemBase::Synchronous)) { |
| 67 es.throwDOMException(InvalidModificationError, ExceptionMessages::failed
ToExecute("moveTo", "EntrySync")); | 67 exceptionState.throwDOMException(InvalidModificationError, ExceptionMess
ages::failedToExecute("moveTo", "EntrySync")); |
| 68 return 0; | 68 return 0; |
| 69 } | 69 } |
| 70 return helper.getResult(es); | 70 return helper.getResult(exceptionState); |
| 71 } | 71 } |
| 72 | 72 |
| 73 PassRefPtr<EntrySync> EntrySync::copyTo(PassRefPtr<DirectoryEntrySync> parent, c
onst String& name, ExceptionState& es) const | 73 PassRefPtr<EntrySync> EntrySync::copyTo(PassRefPtr<DirectoryEntrySync> parent, c
onst String& name, ExceptionState& exceptionState) const |
| 74 { | 74 { |
| 75 EntrySyncCallbackHelper helper; | 75 EntrySyncCallbackHelper helper; |
| 76 if (!m_fileSystem->copy(this, parent.get(), name, helper.successCallback(),
helper.errorCallback(), DOMFileSystemBase::Synchronous)) { | 76 if (!m_fileSystem->copy(this, parent.get(), name, helper.successCallback(),
helper.errorCallback(), DOMFileSystemBase::Synchronous)) { |
| 77 es.throwDOMException(InvalidModificationError, ExceptionMessages::failed
ToExecute("copyTo", "EntrySync")); | 77 exceptionState.throwDOMException(InvalidModificationError, ExceptionMess
ages::failedToExecute("copyTo", "EntrySync")); |
| 78 return 0; | 78 return 0; |
| 79 } | 79 } |
| 80 return helper.getResult(es); | 80 return helper.getResult(exceptionState); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void EntrySync::remove(ExceptionState& es) const | 83 void EntrySync::remove(ExceptionState& exceptionState) const |
| 84 { | 84 { |
| 85 VoidSyncCallbackHelper helper; | 85 VoidSyncCallbackHelper helper; |
| 86 if (!m_fileSystem->remove(this, helper.successCallback(), helper.errorCallba
ck(), DOMFileSystemBase::Synchronous)) { | 86 if (!m_fileSystem->remove(this, helper.successCallback(), helper.errorCallba
ck(), DOMFileSystemBase::Synchronous)) { |
| 87 es.throwDOMException(InvalidModificationError, ExceptionMessages::failed
ToExecute("remove", "EntrySync")); | 87 exceptionState.throwDOMException(InvalidModificationError, ExceptionMess
ages::failedToExecute("remove", "EntrySync")); |
| 88 return; | 88 return; |
| 89 } | 89 } |
| 90 helper.getResult(es); | 90 helper.getResult(exceptionState); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PassRefPtr<EntrySync> EntrySync::getParent() const | 93 PassRefPtr<EntrySync> EntrySync::getParent() const |
| 94 { | 94 { |
| 95 // Sync verion of getParent doesn't throw exceptions. | 95 // Sync verion of getParent doesn't throw exceptions. |
| 96 String parentPath = DOMFilePath::getDirectory(fullPath()); | 96 String parentPath = DOMFilePath::getDirectory(fullPath()); |
| 97 return DirectoryEntrySync::create(m_fileSystem, parentPath); | 97 return DirectoryEntrySync::create(m_fileSystem, parentPath); |
| 98 } | 98 } |
| 99 | 99 |
| 100 EntrySync::EntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& ful
lPath) | 100 EntrySync::EntrySync(PassRefPtr<DOMFileSystemBase> fileSystem, const String& ful
lPath) |
| 101 : EntryBase(fileSystem, fullPath) | 101 : EntryBase(fileSystem, fullPath) |
| 102 { | 102 { |
| 103 ScriptWrappable::init(this); | 103 ScriptWrappable::init(this); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } | 106 } |
| OLD | NEW |