OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 24 matching lines...) Expand all Loading... |
35 #include "bindings/modules/v8/V8DOMFileSystem.h" | 35 #include "bindings/modules/v8/V8DOMFileSystem.h" |
36 #include "bindings/modules/v8/V8DirectoryEntry.h" | 36 #include "bindings/modules/v8/V8DirectoryEntry.h" |
37 #include "bindings/modules/v8/V8FileEntry.h" | 37 #include "bindings/modules/v8/V8FileEntry.h" |
38 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
39 #include "modules/filesystem/DOMFileSystem.h" | 39 #include "modules/filesystem/DOMFileSystem.h" |
40 #include "modules/filesystem/DirectoryEntry.h" | 40 #include "modules/filesystem/DirectoryEntry.h" |
41 #include "modules/filesystem/FileEntry.h" | 41 #include "modules/filesystem/FileEntry.h" |
42 #include "web/WebLocalFrameImpl.h" | 42 #include "web/WebLocalFrameImpl.h" |
43 #include <v8.h> | 43 #include <v8.h> |
44 | 44 |
45 using namespace WebCore; | 45 using namespace blink; |
46 | 46 |
47 namespace blink { | 47 namespace blink { |
48 | 48 |
49 WebDOMFileSystem WebDOMFileSystem::fromV8Value(v8::Handle<v8::Value> value) | 49 WebDOMFileSystem WebDOMFileSystem::fromV8Value(v8::Handle<v8::Value> value) |
50 { | 50 { |
51 if (!V8DOMFileSystem::hasInstance(value, v8::Isolate::GetCurrent())) | 51 if (!V8DOMFileSystem::hasInstance(value, v8::Isolate::GetCurrent())) |
52 return WebDOMFileSystem(); | 52 return WebDOMFileSystem(); |
53 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); | 53 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); |
54 DOMFileSystem* domFileSystem = V8DOMFileSystem::toNative(object); | 54 DOMFileSystem* domFileSystem = V8DOMFileSystem::toNative(object); |
55 ASSERT(domFileSystem); | 55 ASSERT(domFileSystem); |
56 return WebDOMFileSystem(domFileSystem); | 56 return WebDOMFileSystem(domFileSystem); |
57 } | 57 } |
58 | 58 |
59 WebURL WebDOMFileSystem::createFileSystemURL(v8::Handle<v8::Value> value) | 59 WebURL WebDOMFileSystem::createFileSystemURL(v8::Handle<v8::Value> value) |
60 { | 60 { |
61 const FileEntry* const entry = V8FileEntry::toNativeWithTypeCheck(v8::Isolat
e::GetCurrent(), value); | 61 const FileEntry* const entry = V8FileEntry::toNativeWithTypeCheck(v8::Isolat
e::GetCurrent(), value); |
62 if (entry) | 62 if (entry) |
63 return entry->filesystem()->createFileSystemURL(entry); | 63 return entry->filesystem()->createFileSystemURL(entry); |
64 return WebURL(); | 64 return WebURL(); |
65 } | 65 } |
66 | 66 |
67 WebDOMFileSystem WebDOMFileSystem::create( | 67 WebDOMFileSystem WebDOMFileSystem::create( |
68 WebLocalFrame* frame, | 68 WebLocalFrame* frame, |
69 WebFileSystemType type, | 69 WebFileSystemType type, |
70 const WebString& name, | 70 const WebString& name, |
71 const WebURL& rootURL, | 71 const WebURL& rootURL, |
72 SerializableType serializableType) | 72 SerializableType serializableType) |
73 { | 73 { |
74 ASSERT(frame && toWebLocalFrameImpl(frame)->frame()); | 74 ASSERT(frame && toWebLocalFrameImpl(frame)->frame()); |
75 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra
me)->frame()->document(), name, static_cast<WebCore::FileSystemType>(type), root
URL); | 75 DOMFileSystem* domFileSystem = DOMFileSystem::create(toWebLocalFrameImpl(fra
me)->frame()->document(), name, static_cast<blink::FileSystemType>(type), rootUR
L); |
76 if (serializableType == SerializableTypeSerializable) | 76 if (serializableType == SerializableTypeSerializable) |
77 domFileSystem->makeClonable(); | 77 domFileSystem->makeClonable(); |
78 return WebDOMFileSystem(domFileSystem); | 78 return WebDOMFileSystem(domFileSystem); |
79 } | 79 } |
80 | 80 |
81 void WebDOMFileSystem::reset() | 81 void WebDOMFileSystem::reset() |
82 { | 82 { |
83 m_private.reset(); | 83 m_private.reset(); |
84 } | 84 } |
85 | 85 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return toV8(DirectoryEntry::create(m_private.get(), path), creationConte
xt, isolate); | 137 return toV8(DirectoryEntry::create(m_private.get(), path), creationConte
xt, isolate); |
138 ASSERT(entryType == EntryTypeFile); | 138 ASSERT(entryType == EntryTypeFile); |
139 return toV8(FileEntry::create(m_private.get(), path), creationContext, isola
te); | 139 return toV8(FileEntry::create(m_private.get(), path), creationContext, isola
te); |
140 } | 140 } |
141 | 141 |
142 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem) | 142 WebDOMFileSystem::WebDOMFileSystem(DOMFileSystem* domFileSystem) |
143 : m_private(domFileSystem) | 143 : m_private(domFileSystem) |
144 { | 144 { |
145 } | 145 } |
146 | 146 |
147 WebDOMFileSystem& WebDOMFileSystem::operator=(WebCore::DOMFileSystem* domFileSys
tem) | 147 WebDOMFileSystem& WebDOMFileSystem::operator=(blink::DOMFileSystem* domFileSyste
m) |
148 { | 148 { |
149 m_private = domFileSystem; | 149 m_private = domFileSystem; |
150 return *this; | 150 return *this; |
151 } | 151 } |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
OLD | NEW |