OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/file_system/webfilesystem_impl.h" | 5 #include "content/common/file_system/webfilesystem_impl.h" |
6 | 6 |
7 #include "content/common/child_thread.h" | 7 #include "content/common/child_thread.h" |
8 #include "content/common/file_system/file_system_dispatcher.h" | 8 #include "content/common/file_system/file_system_dispatcher.h" |
9 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" | 9 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" |
10 #include "content/common/file_system/webfilewriter_impl.h" | 10 #include "content/common/file_system/webfilewriter_impl.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallback
s.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
14 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
15 | 15 |
16 using WebKit::WebFileInfo; | 16 using WebKit::WebFileInfo; |
17 using WebKit::WebFileSystemCallbacks; | 17 using WebKit::WebFileSystemCallbacks; |
18 using WebKit::WebFileSystemEntry; | 18 using WebKit::WebFileSystemEntry; |
19 using WebKit::WebString; | 19 using WebKit::WebString; |
20 using WebKit::WebVector; | 20 using WebKit::WebVector; |
21 | 21 |
22 WebFileSystemImpl::WebFileSystemImpl() { | 22 WebFileSystemImpl::WebFileSystemImpl() { |
23 } | 23 } |
24 | 24 |
25 void WebFileSystemImpl::move(const WebString& src_path, | 25 void WebFileSystemImpl::move(const WebString& src_path, |
26 const WebString& dest_path, | 26 const WebString& dest_path, |
27 WebFileSystemCallbacks* callbacks) { | 27 WebFileSystemCallbacks* callbacks) { |
28 FileSystemDispatcher* dispatcher = | 28 FileSystemDispatcher* dispatcher = |
29 ChildThread::current()->file_system_dispatcher(); | 29 ChildThread::current()->file_system_dispatcher(); |
30 dispatcher->Move(webkit_glue::WebStringToFilePath(src_path), | 30 dispatcher->Move(GURL(src_path), |
31 webkit_glue::WebStringToFilePath(dest_path), | 31 GURL(dest_path), |
32 new WebFileSystemCallbackDispatcher(callbacks)); | 32 new WebFileSystemCallbackDispatcher(callbacks)); |
33 } | 33 } |
34 | 34 |
35 void WebFileSystemImpl::copy(const WebString& src_path, | 35 void WebFileSystemImpl::copy(const WebString& src_path, |
36 const WebString& dest_path, | 36 const WebString& dest_path, |
37 WebFileSystemCallbacks* callbacks) { | 37 WebFileSystemCallbacks* callbacks) { |
38 FileSystemDispatcher* dispatcher = | 38 FileSystemDispatcher* dispatcher = |
39 ChildThread::current()->file_system_dispatcher(); | 39 ChildThread::current()->file_system_dispatcher(); |
40 dispatcher->Copy(webkit_glue::WebStringToFilePath(src_path), | 40 dispatcher->Copy(GURL(src_path), |
41 webkit_glue::WebStringToFilePath(dest_path), | 41 GURL(dest_path), |
42 new WebFileSystemCallbackDispatcher(callbacks)); | 42 new WebFileSystemCallbackDispatcher(callbacks)); |
43 } | 43 } |
44 | 44 |
45 void WebFileSystemImpl::remove(const WebString& path, | 45 void WebFileSystemImpl::remove(const WebString& path, |
46 WebFileSystemCallbacks* callbacks) { | 46 WebFileSystemCallbacks* callbacks) { |
47 FileSystemDispatcher* dispatcher = | 47 FileSystemDispatcher* dispatcher = |
48 ChildThread::current()->file_system_dispatcher(); | 48 ChildThread::current()->file_system_dispatcher(); |
49 dispatcher->Remove(webkit_glue::WebStringToFilePath(path), | 49 dispatcher->Remove(GURL(path), |
50 false /* recursive */, | 50 false /* recursive */, |
51 new WebFileSystemCallbackDispatcher(callbacks)); | 51 new WebFileSystemCallbackDispatcher(callbacks)); |
52 } | 52 } |
53 | 53 |
54 void WebFileSystemImpl::removeRecursively(const WebString& path, | 54 void WebFileSystemImpl::removeRecursively(const WebString& path, |
55 WebFileSystemCallbacks* callbacks) { | 55 WebFileSystemCallbacks* callbacks) { |
56 FileSystemDispatcher* dispatcher = | 56 FileSystemDispatcher* dispatcher = |
57 ChildThread::current()->file_system_dispatcher(); | 57 ChildThread::current()->file_system_dispatcher(); |
58 dispatcher->Remove(webkit_glue::WebStringToFilePath(path), | 58 dispatcher->Remove(GURL(path), |
59 true /* recursive */, | 59 true /* recursive */, |
60 new WebFileSystemCallbackDispatcher(callbacks)); | 60 new WebFileSystemCallbackDispatcher(callbacks)); |
61 } | 61 } |
62 | 62 |
63 void WebFileSystemImpl::readMetadata(const WebString& path, | 63 void WebFileSystemImpl::readMetadata(const WebString& path, |
64 WebFileSystemCallbacks* callbacks) { | 64 WebFileSystemCallbacks* callbacks) { |
65 FileSystemDispatcher* dispatcher = | 65 FileSystemDispatcher* dispatcher = |
66 ChildThread::current()->file_system_dispatcher(); | 66 ChildThread::current()->file_system_dispatcher(); |
67 dispatcher->ReadMetadata(webkit_glue::WebStringToFilePath(path), | 67 dispatcher->ReadMetadata(GURL(path), |
68 new WebFileSystemCallbackDispatcher(callbacks)); | 68 new WebFileSystemCallbackDispatcher(callbacks)); |
69 } | 69 } |
70 | 70 |
71 void WebFileSystemImpl::createFile(const WebString& path, | 71 void WebFileSystemImpl::createFile(const WebString& path, |
72 bool exclusive, | 72 bool exclusive, |
73 WebFileSystemCallbacks* callbacks) { | 73 WebFileSystemCallbacks* callbacks) { |
74 FileSystemDispatcher* dispatcher = | 74 FileSystemDispatcher* dispatcher = |
75 ChildThread::current()->file_system_dispatcher(); | 75 ChildThread::current()->file_system_dispatcher(); |
76 dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, false, | 76 dispatcher->Create(GURL(path), exclusive, false, |
77 false, new WebFileSystemCallbackDispatcher(callbacks)); | 77 false, new WebFileSystemCallbackDispatcher(callbacks)); |
78 } | 78 } |
79 | 79 |
80 void WebFileSystemImpl::createDirectory(const WebString& path, | 80 void WebFileSystemImpl::createDirectory(const WebString& path, |
81 bool exclusive, | 81 bool exclusive, |
82 WebFileSystemCallbacks* callbacks) { | 82 WebFileSystemCallbacks* callbacks) { |
83 FileSystemDispatcher* dispatcher = | 83 FileSystemDispatcher* dispatcher = |
84 ChildThread::current()->file_system_dispatcher(); | 84 ChildThread::current()->file_system_dispatcher(); |
85 dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, true, | 85 dispatcher->Create(GURL(path), exclusive, true, |
86 false, new WebFileSystemCallbackDispatcher(callbacks)); | 86 false, new WebFileSystemCallbackDispatcher(callbacks)); |
87 } | 87 } |
88 | 88 |
89 void WebFileSystemImpl::fileExists(const WebString& path, | 89 void WebFileSystemImpl::fileExists(const WebString& path, |
90 WebFileSystemCallbacks* callbacks) { | 90 WebFileSystemCallbacks* callbacks) { |
91 FileSystemDispatcher* dispatcher = | 91 FileSystemDispatcher* dispatcher = |
92 ChildThread::current()->file_system_dispatcher(); | 92 ChildThread::current()->file_system_dispatcher(); |
93 dispatcher->Exists(webkit_glue::WebStringToFilePath(path), false, | 93 dispatcher->Exists(GURL(path), false, |
94 new WebFileSystemCallbackDispatcher(callbacks)); | 94 new WebFileSystemCallbackDispatcher(callbacks)); |
95 } | 95 } |
96 | 96 |
97 void WebFileSystemImpl::directoryExists(const WebString& path, | 97 void WebFileSystemImpl::directoryExists(const WebString& path, |
98 WebFileSystemCallbacks* callbacks) { | 98 WebFileSystemCallbacks* callbacks) { |
99 FileSystemDispatcher* dispatcher = | 99 FileSystemDispatcher* dispatcher = |
100 ChildThread::current()->file_system_dispatcher(); | 100 ChildThread::current()->file_system_dispatcher(); |
101 dispatcher->Exists(webkit_glue::WebStringToFilePath(path), true, | 101 dispatcher->Exists(GURL(path), true, |
102 new WebFileSystemCallbackDispatcher(callbacks)); | 102 new WebFileSystemCallbackDispatcher(callbacks)); |
103 } | 103 } |
104 | 104 |
105 void WebFileSystemImpl::readDirectory(const WebString& path, | 105 void WebFileSystemImpl::readDirectory(const WebString& path, |
106 WebFileSystemCallbacks* callbacks) { | 106 WebFileSystemCallbacks* callbacks) { |
107 FileSystemDispatcher* dispatcher = | 107 FileSystemDispatcher* dispatcher = |
108 ChildThread::current()->file_system_dispatcher(); | 108 ChildThread::current()->file_system_dispatcher(); |
109 dispatcher->ReadDirectory(webkit_glue::WebStringToFilePath(path), | 109 dispatcher->ReadDirectory(GURL(path), |
110 new WebFileSystemCallbackDispatcher(callbacks)); | 110 new WebFileSystemCallbackDispatcher(callbacks)); |
111 } | 111 } |
112 | 112 |
113 WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( | 113 WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( |
114 const WebString& path, WebKit::WebFileWriterClient* client) { | 114 const WebString& path, WebKit::WebFileWriterClient* client) { |
115 return new WebFileWriterImpl(path, client); | 115 return new WebFileWriterImpl(GURL(path), client); |
116 } | 116 } |
OLD | NEW |