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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/Entry.cpp

Issue 2297043002: Web expose FileSystemFileEntry, FileSystemDirectoryEntry and friends (Closed)
Patch Set: Rebased Created 4 years 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30 #include "modules/filesystem/Entry.h"
31
32 #include "core/dom/ExecutionContext.h"
33 #include "core/fileapi/FileError.h"
34 #include "core/frame/UseCounter.h"
35 #include "core/html/VoidCallback.h"
36 #include "modules/filesystem/DirectoryEntry.h"
37 #include "modules/filesystem/EntryCallback.h"
38 #include "modules/filesystem/ErrorCallback.h"
39 #include "modules/filesystem/FileSystemCallbacks.h"
40 #include "modules/filesystem/MetadataCallback.h"
41 #include "platform/weborigin/SecurityOrigin.h"
42 #include "wtf/text/StringBuilder.h"
43
44 namespace blink {
45
46 Entry::Entry(DOMFileSystemBase* fileSystem, const String& fullPath)
47 : EntryBase(fileSystem, fullPath) {}
48
49 DOMFileSystem* Entry::filesystem(ExecutionContext* context) const {
50 if (m_fileSystem->type() == FileSystemTypeIsolated)
51 UseCounter::count(
52 context,
53 UseCounter::Entry_Filesystem_AttributeGetter_IsolatedFileSystem);
54 return filesystem();
55 }
56
57 void Entry::getMetadata(ExecutionContext* context,
58 MetadataCallback* successCallback,
59 ErrorCallback* errorCallback) {
60 if (m_fileSystem->type() == FileSystemTypeIsolated)
61 UseCounter::count(context,
62 UseCounter::Entry_GetMetadata_Method_IsolatedFileSystem);
63 m_fileSystem->getMetadata(this, successCallback,
64 ScriptErrorCallback::wrap(errorCallback));
65 }
66
67 void Entry::moveTo(ExecutionContext* context,
68 DirectoryEntry* parent,
69 const String& name,
70 EntryCallback* successCallback,
71 ErrorCallback* errorCallback) const {
72 if (m_fileSystem->type() == FileSystemTypeIsolated)
73 UseCounter::count(context,
74 UseCounter::Entry_MoveTo_Method_IsolatedFileSystem);
75 m_fileSystem->move(this, parent, name, successCallback,
76 ScriptErrorCallback::wrap(errorCallback));
77 }
78
79 void Entry::copyTo(ExecutionContext* context,
80 DirectoryEntry* parent,
81 const String& name,
82 EntryCallback* successCallback,
83 ErrorCallback* errorCallback) const {
84 if (m_fileSystem->type() == FileSystemTypeIsolated)
85 UseCounter::count(context,
86 UseCounter::Entry_CopyTo_Method_IsolatedFileSystem);
87 m_fileSystem->copy(this, parent, name, successCallback,
88 ScriptErrorCallback::wrap(errorCallback));
89 }
90
91 void Entry::remove(ExecutionContext* context,
92 VoidCallback* successCallback,
93 ErrorCallback* errorCallback) const {
94 if (m_fileSystem->type() == FileSystemTypeIsolated)
95 UseCounter::count(context,
96 UseCounter::Entry_Remove_Method_IsolatedFileSystem);
97 m_fileSystem->remove(this, successCallback,
98 ScriptErrorCallback::wrap(errorCallback));
99 }
100
101 void Entry::getParent(ExecutionContext* context,
102 EntryCallback* successCallback,
103 ErrorCallback* errorCallback) const {
104 if (m_fileSystem->type() == FileSystemTypeIsolated)
105 UseCounter::count(context,
106 UseCounter::Entry_GetParent_Method_IsolatedFileSystem);
107 m_fileSystem->getParent(this, successCallback,
108 ScriptErrorCallback::wrap(errorCallback));
109 }
110
111 String Entry::toURL(ExecutionContext* context) const {
112 if (m_fileSystem->type() == FileSystemTypeIsolated)
113 UseCounter::count(context,
114 UseCounter::Entry_ToURL_Method_IsolatedFileSystem);
115 return static_cast<const EntryBase*>(this)->toURL();
116 }
117
118 DEFINE_TRACE(Entry) {
119 EntryBase::trace(visitor);
120 }
121
122 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/filesystem/Entry.h ('k') | third_party/WebKit/Source/modules/filesystem/Entry.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698