| 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/chromeos/file_system_provider/operations/read_directory
.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/read_directory
.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" | 10 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 return false; | 28 return false; |
| 29 | 29 |
| 30 for (size_t i = 0; i < params->entries.size(); ++i) { | 30 for (size_t i = 0; i < params->entries.size(); ++i) { |
| 31 const linked_ptr<EntryMetadata> entry_metadata = params->entries[i]; | 31 const linked_ptr<EntryMetadata> entry_metadata = params->entries[i]; |
| 32 if (!ValidateIDLEntryMetadata(*entry_metadata, false /* root_entry */)) | 32 if (!ValidateIDLEntryMetadata(*entry_metadata, false /* root_entry */)) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 storage::DirectoryEntry output_entry; | 35 storage::DirectoryEntry output_entry; |
| 36 output_entry.is_directory = entry_metadata->is_directory; | 36 output_entry.is_directory = entry_metadata->is_directory; |
| 37 output_entry.name = entry_metadata->name; | 37 output_entry.name = entry_metadata->name; |
| 38 output_entry.size = static_cast<int64>(entry_metadata->size); | |
| 39 | |
| 40 std::string input_modification_time; | |
| 41 if (!entry_metadata->modification_time.additional_properties.GetString( | |
| 42 "value", &input_modification_time)) { | |
| 43 NOTREACHED(); | |
| 44 } | |
| 45 if (!base::Time::FromString(input_modification_time.c_str(), | |
| 46 &output_entry.last_modified_time)) { | |
| 47 NOTREACHED(); | |
| 48 } | |
| 49 | 38 |
| 50 output->push_back(output_entry); | 39 output->push_back(output_entry); |
| 51 } | 40 } |
| 52 | 41 |
| 53 return true; | 42 return true; |
| 54 } | 43 } |
| 55 | 44 |
| 56 } // namespace | 45 } // namespace |
| 57 | 46 |
| 58 ReadDirectory::ReadDirectory( | 47 ReadDirectory::ReadDirectory( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void ReadDirectory::OnError(int /* request_id */, | 96 void ReadDirectory::OnError(int /* request_id */, |
| 108 scoped_ptr<RequestValue> /* result */, | 97 scoped_ptr<RequestValue> /* result */, |
| 109 base::File::Error error) { | 98 base::File::Error error) { |
| 110 callback_.Run( | 99 callback_.Run( |
| 111 error, storage::AsyncFileUtil::EntryList(), false /* has_more */); | 100 error, storage::AsyncFileUtil::EntryList(), false /* has_more */); |
| 112 } | 101 } |
| 113 | 102 |
| 114 } // namespace operations | 103 } // namespace operations |
| 115 } // namespace file_system_provider | 104 } // namespace file_system_provider |
| 116 } // namespace chromeos | 105 } // namespace chromeos |
| OLD | NEW |