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 <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
15 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 16 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
16 #include "webkit/blob/shareable_file_reference.h" | 17 #include "webkit/blob/shareable_file_reference.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 GDataDirectory* directory = entry ? entry->AsGDataDirectory() : NULL; | 249 GDataDirectory* directory = entry ? entry->AsGDataDirectory() : NULL; |
249 if (!directory && error == base::PLATFORM_FILE_OK) | 250 if (!directory && error == base::PLATFORM_FILE_OK) |
250 error = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; | 251 error = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; |
251 | 252 |
252 if (error != base::PLATFORM_FILE_OK) { | 253 if (error != base::PLATFORM_FILE_OK) { |
253 callback.Run(error, std::vector<base::FileUtilProxy::Entry>(), false); | 254 callback.Run(error, std::vector<base::FileUtilProxy::Entry>(), false); |
254 return; | 255 return; |
255 } | 256 } |
256 std::vector<base::FileUtilProxy::Entry> entries; | 257 std::vector<base::FileUtilProxy::Entry> entries; |
257 // Convert gdata files to something File API stack can understand. | 258 // Convert gdata files to something File API stack can understand. |
| 259 for (GDataDirectoryCollection::const_iterator iter = |
| 260 directory->child_directories().begin(); |
| 261 iter != directory->child_directories().end(); ++iter) { |
| 262 entries.push_back(GDataEntryToFileUtilProxyEntry(*(iter->second))); |
| 263 } |
258 for (GDataFileCollection::const_iterator iter = | 264 for (GDataFileCollection::const_iterator iter = |
259 directory->children().begin(); | 265 directory->child_files().begin(); |
260 iter != directory->children().end(); ++iter) { | 266 iter != directory->child_files().end(); ++iter) { |
261 if (hide_hosted_documents) { | 267 if (hide_hosted_documents) { |
262 GDataFile* file = iter->second->AsGDataFile(); | 268 GDataFile* file = iter->second; |
263 if (file && file->is_hosted_document()) | 269 if (file->is_hosted_document()) |
264 continue; | 270 continue; |
265 } | 271 } |
266 | |
267 entries.push_back(GDataEntryToFileUtilProxyEntry(*(iter->second))); | 272 entries.push_back(GDataEntryToFileUtilProxyEntry(*(iter->second))); |
268 } | 273 } |
269 | 274 |
270 callback.Run(base::PLATFORM_FILE_OK, entries, false); | 275 callback.Run(base::PLATFORM_FILE_OK, entries, false); |
271 } | 276 } |
272 | 277 |
273 } // namespace gdata | 278 } // namespace gdata |
OLD | NEW |