OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" | 5 #include "chrome/browser/local_discovery/storage/privet_filesystem_async_util.h" |
6 | 6 |
7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
8 #include "webkit/browser/fileapi/file_system_url.h" | 8 #include "webkit/browser/fileapi/file_system_url.h" |
9 #include "webkit/common/blob/shareable_file_reference.h" | 9 #include "webkit/common/blob/shareable_file_reference.h" |
10 | 10 |
11 namespace local_discovery { | 11 namespace local_discovery { |
12 | 12 |
13 void PrivetFileSystemAsyncUtil::CreateOrOpen( | 13 void PrivetFileSystemAsyncUtil::CreateOrOpen( |
14 scoped_ptr<fileapi::FileSystemOperationContext> context, | 14 scoped_ptr<fileapi::FileSystemOperationContext> context, |
15 const fileapi::FileSystemURL& url, | 15 const fileapi::FileSystemURL& url, |
16 int file_flags, | 16 int file_flags, |
17 const CreateOrOpenCallback& callback) { | 17 const CreateOrOpenCallback& callback) { |
18 NOTIMPLEMENTED(); | 18 NOTIMPLEMENTED(); |
19 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, | 19 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, |
20 base::PassPlatformFile(NULL), | 20 base::PassPlatformFile(NULL), |
21 base::Closure()); | 21 base::Closure()); |
22 } | 22 } |
23 | 23 |
24 void PrivetFileSystemAsyncUtil::EnsureFileExists( | 24 void PrivetFileSystemAsyncUtil::EnsureFileExists( |
25 scoped_ptr<fileapi::FileSystemOperationContext> context, | 25 scoped_ptr<fileapi::FileSystemOperationContext> context, |
26 const fileapi::FileSystemURL& url, | 26 const fileapi::FileSystemURL& url, |
27 const EnsureFileExistsCallback& callback) { | 27 const EnsureFileExistsCallback& callback) { |
28 NOTIMPLEMENTED(); | 28 NOTIMPLEMENTED(); |
29 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, | 29 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, false); |
30 false); | |
31 } | 30 } |
32 | 31 |
33 void PrivetFileSystemAsyncUtil::CreateDirectory( | 32 void PrivetFileSystemAsyncUtil::CreateDirectory( |
34 scoped_ptr<fileapi::FileSystemOperationContext> context, | 33 scoped_ptr<fileapi::FileSystemOperationContext> context, |
35 const fileapi::FileSystemURL& url, | 34 const fileapi::FileSystemURL& url, |
36 bool exclusive, | 35 bool exclusive, |
37 bool recursive, | 36 bool recursive, |
38 const StatusCallback& callback) { | 37 const StatusCallback& callback) { |
39 NOTIMPLEMENTED(); | 38 NOTIMPLEMENTED(); |
40 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 39 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
41 } | 40 } |
42 | 41 |
43 void PrivetFileSystemAsyncUtil::GetFileInfo( | 42 void PrivetFileSystemAsyncUtil::GetFileInfo( |
44 scoped_ptr<fileapi::FileSystemOperationContext> context, | 43 scoped_ptr<fileapi::FileSystemOperationContext> context, |
45 const fileapi::FileSystemURL& url, | 44 const fileapi::FileSystemURL& url, |
46 const GetFileInfoCallback& callback) { | 45 const GetFileInfoCallback& callback) { |
47 base::PlatformFileInfo file_info; | 46 base::File::Info file_info; |
48 | 47 |
49 if (url.path() == base::FilePath(FILE_PATH_LITERAL("/privet"))) { | 48 if (url.path() == base::FilePath(FILE_PATH_LITERAL("/privet"))) { |
50 file_info.size = 20; | 49 file_info.size = 20; |
51 file_info.is_directory = true; | 50 file_info.is_directory = true; |
52 file_info.is_symbolic_link = false; | 51 file_info.is_symbolic_link = false; |
53 } else { | 52 } else { |
54 file_info.size = 3000; | 53 file_info.size = 3000; |
55 file_info.is_directory = false; | 54 file_info.is_directory = false; |
56 file_info.is_symbolic_link = false; | 55 file_info.is_symbolic_link = false; |
57 } | 56 } |
58 callback.Run(base::PLATFORM_FILE_OK, | 57 callback.Run(base::File::FILE_OK, file_info); |
59 file_info); | |
60 } | 58 } |
61 | 59 |
62 void PrivetFileSystemAsyncUtil::ReadDirectory( | 60 void PrivetFileSystemAsyncUtil::ReadDirectory( |
63 scoped_ptr<fileapi::FileSystemOperationContext> context, | 61 scoped_ptr<fileapi::FileSystemOperationContext> context, |
64 const fileapi::FileSystemURL& url, | 62 const fileapi::FileSystemURL& url, |
65 const ReadDirectoryCallback& callback) { | 63 const ReadDirectoryCallback& callback) { |
66 EntryList entry_list; | 64 EntryList entry_list; |
67 | 65 |
68 fileapi::DirectoryEntry entry("Random file", | 66 fileapi::DirectoryEntry entry("Random file", |
69 fileapi::DirectoryEntry::FILE, | 67 fileapi::DirectoryEntry::FILE, |
70 3000, | 68 3000, |
71 base::Time()); | 69 base::Time()); |
72 entry_list.push_back(entry); | 70 entry_list.push_back(entry); |
73 | 71 |
74 callback.Run(base::PLATFORM_FILE_OK, entry_list, false); | 72 callback.Run(base::File::FILE_OK, entry_list, false); |
75 } | 73 } |
76 | 74 |
77 void PrivetFileSystemAsyncUtil::Touch( | 75 void PrivetFileSystemAsyncUtil::Touch( |
78 scoped_ptr<fileapi::FileSystemOperationContext> context, | 76 scoped_ptr<fileapi::FileSystemOperationContext> context, |
79 const fileapi::FileSystemURL& url, | 77 const fileapi::FileSystemURL& url, |
80 const base::Time& last_access_time, | 78 const base::Time& last_access_time, |
81 const base::Time& last_modified_time, | 79 const base::Time& last_modified_time, |
82 const StatusCallback& callback) { | 80 const StatusCallback& callback) { |
83 NOTIMPLEMENTED(); | 81 NOTIMPLEMENTED(); |
84 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 82 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
85 } | 83 } |
86 | 84 |
87 void PrivetFileSystemAsyncUtil::Truncate( | 85 void PrivetFileSystemAsyncUtil::Truncate( |
88 scoped_ptr<fileapi::FileSystemOperationContext> context, | 86 scoped_ptr<fileapi::FileSystemOperationContext> context, |
89 const fileapi::FileSystemURL& url, | 87 const fileapi::FileSystemURL& url, |
90 int64 length, | 88 int64 length, |
91 const StatusCallback& callback) { | 89 const StatusCallback& callback) { |
92 NOTIMPLEMENTED(); | 90 NOTIMPLEMENTED(); |
93 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 91 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
94 } | 92 } |
95 | 93 |
96 void PrivetFileSystemAsyncUtil::CopyFileLocal( | 94 void PrivetFileSystemAsyncUtil::CopyFileLocal( |
97 scoped_ptr<fileapi::FileSystemOperationContext> context, | 95 scoped_ptr<fileapi::FileSystemOperationContext> context, |
98 const fileapi::FileSystemURL& src_url, | 96 const fileapi::FileSystemURL& src_url, |
99 const fileapi::FileSystemURL& dest_url, | 97 const fileapi::FileSystemURL& dest_url, |
100 CopyOrMoveOption option, | 98 CopyOrMoveOption option, |
101 const CopyFileProgressCallback& progress_callback, | 99 const CopyFileProgressCallback& progress_callback, |
102 const StatusCallback& callback) { | 100 const StatusCallback& callback) { |
103 NOTIMPLEMENTED(); | 101 NOTIMPLEMENTED(); |
104 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 102 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
105 } | 103 } |
106 | 104 |
107 void PrivetFileSystemAsyncUtil::MoveFileLocal( | 105 void PrivetFileSystemAsyncUtil::MoveFileLocal( |
108 scoped_ptr<fileapi::FileSystemOperationContext> context, | 106 scoped_ptr<fileapi::FileSystemOperationContext> context, |
109 const fileapi::FileSystemURL& src_url, | 107 const fileapi::FileSystemURL& src_url, |
110 const fileapi::FileSystemURL& dest_url, | 108 const fileapi::FileSystemURL& dest_url, |
111 CopyOrMoveOption option, | 109 CopyOrMoveOption option, |
112 const StatusCallback& callback) { | 110 const StatusCallback& callback) { |
113 NOTIMPLEMENTED(); | 111 NOTIMPLEMENTED(); |
114 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 112 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
115 } | 113 } |
116 | 114 |
117 void PrivetFileSystemAsyncUtil::CopyInForeignFile( | 115 void PrivetFileSystemAsyncUtil::CopyInForeignFile( |
118 scoped_ptr<fileapi::FileSystemOperationContext> context, | 116 scoped_ptr<fileapi::FileSystemOperationContext> context, |
119 const base::FilePath& src_file_path, | 117 const base::FilePath& src_file_path, |
120 const fileapi::FileSystemURL& dest_url, | 118 const fileapi::FileSystemURL& dest_url, |
121 const StatusCallback& callback) { | 119 const StatusCallback& callback) { |
122 NOTIMPLEMENTED(); | 120 NOTIMPLEMENTED(); |
123 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 121 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
124 } | 122 } |
125 | 123 |
126 void PrivetFileSystemAsyncUtil::DeleteFile( | 124 void PrivetFileSystemAsyncUtil::DeleteFile( |
127 scoped_ptr<fileapi::FileSystemOperationContext> context, | 125 scoped_ptr<fileapi::FileSystemOperationContext> context, |
128 const fileapi::FileSystemURL& url, | 126 const fileapi::FileSystemURL& url, |
129 const StatusCallback& callback) { | 127 const StatusCallback& callback) { |
130 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
131 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 129 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
132 } | 130 } |
133 | 131 |
134 void PrivetFileSystemAsyncUtil::DeleteDirectory( | 132 void PrivetFileSystemAsyncUtil::DeleteDirectory( |
135 scoped_ptr<fileapi::FileSystemOperationContext> context, | 133 scoped_ptr<fileapi::FileSystemOperationContext> context, |
136 const fileapi::FileSystemURL& url, | 134 const fileapi::FileSystemURL& url, |
137 const StatusCallback& callback) { | 135 const StatusCallback& callback) { |
138 NOTIMPLEMENTED(); | 136 NOTIMPLEMENTED(); |
139 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 137 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
140 } | 138 } |
141 | 139 |
142 void PrivetFileSystemAsyncUtil::DeleteRecursively( | 140 void PrivetFileSystemAsyncUtil::DeleteRecursively( |
143 scoped_ptr<fileapi::FileSystemOperationContext> context, | 141 scoped_ptr<fileapi::FileSystemOperationContext> context, |
144 const fileapi::FileSystemURL& url, | 142 const fileapi::FileSystemURL& url, |
145 const StatusCallback& callback) { | 143 const StatusCallback& callback) { |
146 NOTIMPLEMENTED(); | 144 NOTIMPLEMENTED(); |
147 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 145 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
148 } | 146 } |
149 | 147 |
150 void PrivetFileSystemAsyncUtil::CreateSnapshotFile( | 148 void PrivetFileSystemAsyncUtil::CreateSnapshotFile( |
151 scoped_ptr<fileapi::FileSystemOperationContext> context, | 149 scoped_ptr<fileapi::FileSystemOperationContext> context, |
152 const fileapi::FileSystemURL& url, | 150 const fileapi::FileSystemURL& url, |
153 const CreateSnapshotFileCallback& callback) { | 151 const CreateSnapshotFileCallback& callback) { |
154 NOTIMPLEMENTED(); | 152 NOTIMPLEMENTED(); |
155 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, | 153 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, |
156 base::PlatformFileInfo(), | 154 base::File::Info(), |
157 base::FilePath(), | 155 base::FilePath(), |
158 scoped_refptr<webkit_blob::ShareableFileReference>()); | 156 scoped_refptr<webkit_blob::ShareableFileReference>()); |
159 } | 157 } |
160 | 158 |
161 } // namespace local_discovery | 159 } // namespace local_discovery |
OLD | NEW |