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 25 matching lines...) Expand all Loading... |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 #include "modules/filesystem/DOMFilePath.h" | 37 #include "modules/filesystem/DOMFilePath.h" |
38 #include "modules/filesystem/DirectoryEntry.h" | 38 #include "modules/filesystem/DirectoryEntry.h" |
39 #include "modules/filesystem/DirectoryEntrySync.h" | 39 #include "modules/filesystem/DirectoryEntrySync.h" |
40 #include "modules/filesystem/FileEntrySync.h" | 40 #include "modules/filesystem/FileEntrySync.h" |
41 #include "modules/filesystem/Metadata.h" | 41 #include "modules/filesystem/Metadata.h" |
42 #include "modules/filesystem/SyncCallbackHelper.h" | 42 #include "modules/filesystem/SyncCallbackHelper.h" |
43 | 43 |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 PassRefPtrWillBeRawPtr<EntrySync> EntrySync::create(EntryBase* entry) | 46 EntrySync* EntrySync::create(EntryBase* entry) |
47 { | 47 { |
48 if (entry->isFile()) | 48 if (entry->isFile()) |
49 return FileEntrySync::create(entry->m_fileSystem, entry->m_fullPath); | 49 return FileEntrySync::create(entry->m_fileSystem, entry->m_fullPath); |
50 return DirectoryEntrySync::create(entry->m_fileSystem, entry->m_fullPath); | 50 return DirectoryEntrySync::create(entry->m_fileSystem, entry->m_fullPath); |
51 } | 51 } |
52 | 52 |
53 PassRefPtrWillBeRawPtr<Metadata> EntrySync::getMetadata(ExceptionState& exceptio
nState) | 53 Metadata* EntrySync::getMetadata(ExceptionState& exceptionState) |
54 { | 54 { |
55 RefPtr<MetadataSyncCallbackHelper> helper = MetadataSyncCallbackHelper::crea
te(); | 55 RefPtr<MetadataSyncCallbackHelper> helper = MetadataSyncCallbackHelper::crea
te(); |
56 m_fileSystem->getMetadata(this, helper->successCallback(), helper->errorCall
back(), DOMFileSystemBase::Synchronous); | 56 m_fileSystem->getMetadata(this, helper->successCallback(), helper->errorCall
back(), DOMFileSystemBase::Synchronous); |
57 return helper->getResult(exceptionState); | 57 return helper->getResult(exceptionState); |
58 } | 58 } |
59 | 59 |
60 PassRefPtrWillBeRawPtr<EntrySync> EntrySync::moveTo(PassRefPtrWillBeRawPtr<Direc
toryEntrySync> parent, const String& name, ExceptionState& exceptionState) const | 60 EntrySync* EntrySync::moveTo(DirectoryEntrySync* parent, const String& name, Exc
eptionState& exceptionState) const |
61 { | 61 { |
62 RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create(); | 62 RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create(); |
63 m_fileSystem->move(this, parent.get(), name, helper->successCallback(), help
er->errorCallback(), DOMFileSystemBase::Synchronous); | 63 m_fileSystem->move(this, parent, name, helper->successCallback(), helper->er
rorCallback(), DOMFileSystemBase::Synchronous); |
64 return helper->getResult(exceptionState); | 64 return helper->getResult(exceptionState); |
65 } | 65 } |
66 | 66 |
67 PassRefPtrWillBeRawPtr<EntrySync> EntrySync::copyTo(PassRefPtrWillBeRawPtr<Direc
toryEntrySync> parent, const String& name, ExceptionState& exceptionState) const | 67 EntrySync* EntrySync::copyTo(DirectoryEntrySync* parent, const String& name, Exc
eptionState& exceptionState) const |
68 { | 68 { |
69 RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create(); | 69 RefPtr<EntrySyncCallbackHelper> helper = EntrySyncCallbackHelper::create(); |
70 m_fileSystem->copy(this, parent.get(), name, helper->successCallback(), help
er->errorCallback(), DOMFileSystemBase::Synchronous); | 70 m_fileSystem->copy(this, parent, name, helper->successCallback(), helper->er
rorCallback(), DOMFileSystemBase::Synchronous); |
71 return helper->getResult(exceptionState); | 71 return helper->getResult(exceptionState); |
72 } | 72 } |
73 | 73 |
74 void EntrySync::remove(ExceptionState& exceptionState) const | 74 void EntrySync::remove(ExceptionState& exceptionState) const |
75 { | 75 { |
76 RefPtr<VoidSyncCallbackHelper> helper = VoidSyncCallbackHelper::create(); | 76 RefPtr<VoidSyncCallbackHelper> helper = VoidSyncCallbackHelper::create(); |
77 m_fileSystem->remove(this, helper->successCallback(), helper->errorCallback(
), DOMFileSystemBase::Synchronous); | 77 m_fileSystem->remove(this, helper->successCallback(), helper->errorCallback(
), DOMFileSystemBase::Synchronous); |
78 helper->getResult(exceptionState); | 78 helper->getResult(exceptionState); |
79 } | 79 } |
80 | 80 |
81 PassRefPtrWillBeRawPtr<EntrySync> EntrySync::getParent() const | 81 EntrySync* EntrySync::getParent() const |
82 { | 82 { |
83 // Sync verion of getParent doesn't throw exceptions. | 83 // Sync verion of getParent doesn't throw exceptions. |
84 String parentPath = DOMFilePath::getDirectory(fullPath()); | 84 String parentPath = DOMFilePath::getDirectory(fullPath()); |
85 return DirectoryEntrySync::create(m_fileSystem, parentPath); | 85 return DirectoryEntrySync::create(m_fileSystem, parentPath); |
86 } | 86 } |
87 | 87 |
88 EntrySync::EntrySync(PassRefPtrWillBeRawPtr<DOMFileSystemBase> fileSystem, const
String& fullPath) | 88 EntrySync::EntrySync(DOMFileSystemBase* fileSystem, const String& fullPath) |
89 : EntryBase(fileSystem, fullPath) | 89 : EntryBase(fileSystem, fullPath) |
90 { | 90 { |
91 ScriptWrappable::init(this); | 91 ScriptWrappable::init(this); |
92 } | 92 } |
93 | 93 |
94 void EntrySync::trace(Visitor* visitor) | 94 void EntrySync::trace(Visitor* visitor) |
95 { | 95 { |
96 EntryBase::trace(visitor); | 96 EntryBase::trace(visitor); |
97 } | 97 } |
98 | 98 |
99 } | 99 } |
OLD | NEW |