OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/gdata/gdata_file_system_proxy.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 callback.Run(base::PLATFORM_FILE_OK, file_info, file_path); | 242 callback.Run(base::PLATFORM_FILE_OK, file_info, file_path); |
243 } | 243 } |
244 | 244 |
245 void GDataFileSystemProxy::OnReadDirectory( | 245 void GDataFileSystemProxy::OnReadDirectory( |
246 bool hide_hosted_documents, | 246 bool hide_hosted_documents, |
247 const FileSystemOperationInterface::ReadDirectoryCallback& | 247 const FileSystemOperationInterface::ReadDirectoryCallback& |
248 callback, | 248 callback, |
249 base::PlatformFileError error, | 249 base::PlatformFileError error, |
250 scoped_ptr<gdata::GDataDirectoryProto> directory_proto) { | 250 scoped_ptr<gdata::GDataDirectoryProto> directory_proto) { |
251 DCHECK(error != base::PLATFORM_FILE_OK); | |
252 | |
253 if (error != base::PLATFORM_FILE_OK) { | 251 if (error != base::PLATFORM_FILE_OK) { |
254 callback.Run(error, std::vector<base::FileUtilProxy::Entry>(), false); | 252 callback.Run(error, std::vector<base::FileUtilProxy::Entry>(), false); |
255 return; | 253 return; |
256 } | 254 } |
257 std::vector<base::FileUtilProxy::Entry> entries; | 255 std::vector<base::FileUtilProxy::Entry> entries; |
258 // Convert gdata files to something File API stack can understand. | 256 // Convert gdata files to something File API stack can understand. |
259 for (int i = 0; i < directory_proto->child_directories_size(); ++i) { | 257 for (int i = 0; i < directory_proto->child_directories_size(); ++i) { |
260 const GDataDirectoryProto& proto = directory_proto->child_directories(i); | 258 const GDataDirectoryProto& proto = directory_proto->child_directories(i); |
261 entries.push_back( | 259 entries.push_back( |
262 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry())); | 260 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry())); |
263 } | 261 } |
264 for (int i = 0; i < directory_proto->child_files_size(); ++i) { | 262 for (int i = 0; i < directory_proto->child_files_size(); ++i) { |
265 const GDataFileProto& proto = directory_proto->child_files(i); | 263 const GDataFileProto& proto = directory_proto->child_files(i); |
266 if (hide_hosted_documents && proto.is_hosted_document()) | 264 if (hide_hosted_documents && proto.is_hosted_document()) |
267 continue; | 265 continue; |
268 entries.push_back( | 266 entries.push_back( |
269 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry())); | 267 GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry())); |
270 } | 268 } |
271 | 269 |
272 callback.Run(base::PLATFORM_FILE_OK, entries, false); | 270 callback.Run(base::PLATFORM_FILE_OK, entries, false); |
273 } | 271 } |
274 | 272 |
275 } // namespace gdata | 273 } // namespace gdata |
OLD | NEW |