| 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/get_metadata.h
" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h
" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "chrome/common/extensions/api/file_system_provider.h" | 12 #include "chrome/common/extensions/api/file_system_provider.h" |
| 11 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 13 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
| 12 | 14 |
| 13 namespace chromeos { | 15 namespace chromeos { |
| 14 namespace file_system_provider { | 16 namespace file_system_provider { |
| 15 namespace operations { | 17 namespace operations { |
| 16 namespace { | 18 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 if (!ValidateIDLEntryMetadata(params->metadata, fields, root_entry)) | 33 if (!ValidateIDLEntryMetadata(params->metadata, fields, root_entry)) |
| 32 return false; | 34 return false; |
| 33 | 35 |
| 34 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_NAME) | 36 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_NAME) |
| 35 output->name.reset(new std::string(*params->metadata.name)); | 37 output->name.reset(new std::string(*params->metadata.name)); |
| 36 | 38 |
| 37 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_IS_DIRECTORY) | 39 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_IS_DIRECTORY) |
| 38 output->is_directory.reset(new bool(*params->metadata.is_directory)); | 40 output->is_directory.reset(new bool(*params->metadata.is_directory)); |
| 39 | 41 |
| 40 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_SIZE) | 42 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_SIZE) |
| 41 output->size.reset(new int64(static_cast<int64>(*params->metadata.size))); | 43 output->size.reset( |
| 44 new int64_t(static_cast<int64_t>(*params->metadata.size))); |
| 42 | 45 |
| 43 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MODIFICATION_TIME) { | 46 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MODIFICATION_TIME) { |
| 44 std::string input_modification_time; | 47 std::string input_modification_time; |
| 45 params->metadata.modification_time->additional_properties.GetString( | 48 params->metadata.modification_time->additional_properties.GetString( |
| 46 "value", &input_modification_time); | 49 "value", &input_modification_time); |
| 47 | 50 |
| 48 // Allow to pass invalid modification time, since there is no way to verify | 51 // Allow to pass invalid modification time, since there is no way to verify |
| 49 // it easily on any earlier stage. | 52 // it easily on any earlier stage. |
| 50 base::Time output_modification_time; | 53 base::Time output_modification_time; |
| 51 base::Time::FromString(input_modification_time.c_str(), | 54 base::Time::FromString(input_modification_time.c_str(), |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 192 |
| 190 void GetMetadata::OnError(int /* request_id */, | 193 void GetMetadata::OnError(int /* request_id */, |
| 191 scoped_ptr<RequestValue> /* result */, | 194 scoped_ptr<RequestValue> /* result */, |
| 192 base::File::Error error) { | 195 base::File::Error error) { |
| 193 callback_.Run(make_scoped_ptr<EntryMetadata>(NULL), error); | 196 callback_.Run(make_scoped_ptr<EntryMetadata>(NULL), error); |
| 194 } | 197 } |
| 195 | 198 |
| 196 } // namespace operations | 199 } // namespace operations |
| 197 } // namespace file_system_provider | 200 } // namespace file_system_provider |
| 198 } // namespace chromeos | 201 } // namespace chromeos |
| OLD | NEW |