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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
| 13 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
14 #include "chrome/common/extensions/api/file_system_provider.h" | 15 #include "chrome/common/extensions/api/file_system_provider.h" |
15 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 16 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 namespace file_system_provider { | 19 namespace file_system_provider { |
19 namespace operations { | 20 namespace operations { |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Convert |value| into |output|. If parsing fails, then returns false. | 23 // Convert |value| into |output|. If parsing fails, then returns false. |
(...skipping 23 matching lines...) Expand all Loading... |
46 new int64_t(static_cast<int64_t>(*params->metadata.size))); | 47 new int64_t(static_cast<int64_t>(*params->metadata.size))); |
47 | 48 |
48 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MODIFICATION_TIME) { | 49 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MODIFICATION_TIME) { |
49 std::string input_modification_time; | 50 std::string input_modification_time; |
50 params->metadata.modification_time->additional_properties.GetString( | 51 params->metadata.modification_time->additional_properties.GetString( |
51 "value", &input_modification_time); | 52 "value", &input_modification_time); |
52 | 53 |
53 // Allow to pass invalid modification time, since there is no way to verify | 54 // Allow to pass invalid modification time, since there is no way to verify |
54 // it easily on any earlier stage. | 55 // it easily on any earlier stage. |
55 base::Time output_modification_time; | 56 base::Time output_modification_time; |
56 base::Time::FromString(input_modification_time.c_str(), | 57 ignore_result(base::Time::FromString(input_modification_time.c_str(), |
57 &output_modification_time); | 58 &output_modification_time)); |
58 output->modification_time.reset(new base::Time(output_modification_time)); | 59 output->modification_time.reset(new base::Time(output_modification_time)); |
59 } | 60 } |
60 | 61 |
61 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MIME_TYPE && | 62 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_MIME_TYPE && |
62 params->metadata.mime_type.get()) { | 63 params->metadata.mime_type.get()) { |
63 output->mime_type.reset(new std::string(*params->metadata.mime_type.get())); | 64 output->mime_type.reset(new std::string(*params->metadata.mime_type.get())); |
64 } | 65 } |
65 | 66 |
66 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_THUMBNAIL && | 67 if (fields & ProvidedFileSystemInterface::METADATA_FIELD_THUMBNAIL && |
67 params->metadata.thumbnail.get()) { | 68 params->metadata.thumbnail.get()) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 195 |
195 void GetMetadata::OnError(int /* request_id */, | 196 void GetMetadata::OnError(int /* request_id */, |
196 std::unique_ptr<RequestValue> /* result */, | 197 std::unique_ptr<RequestValue> /* result */, |
197 base::File::Error error) { | 198 base::File::Error error) { |
198 callback_.Run(base::WrapUnique<EntryMetadata>(NULL), error); | 199 callback_.Run(base::WrapUnique<EntryMetadata>(NULL), error); |
199 } | 200 } |
200 | 201 |
201 } // namespace operations | 202 } // namespace operations |
202 } // namespace file_system_provider | 203 } // namespace file_system_provider |
203 } // namespace chromeos | 204 } // namespace chromeos |
OLD | NEW |