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 "components/drive/resource_entry_conversion.h" | 5 #include "components/drive/resource_entry_conversion.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
11 #include "components/drive/drive.pb.h" | 13 #include "components/drive/drive.pb.h" |
12 #include "components/drive/drive_api_util.h" | 14 #include "components/drive/drive_api_util.h" |
13 #include "components/drive/file_system_core_util.h" | 15 #include "components/drive/file_system_core_util.h" |
14 #include "google_apis/drive/drive_api_parser.h" | 16 #include "google_apis/drive/drive_api_parser.h" |
15 | 17 |
16 namespace drive { | 18 namespace drive { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // it has no effect on the quota. | 102 // it has no effect on the quota. |
101 file_info->set_size(0); | 103 file_info->set_size(0); |
102 file_specific_info->set_is_hosted_document(true); | 104 file_specific_info->set_is_hosted_document(true); |
103 } | 105 } |
104 file_info->set_is_directory(false); | 106 file_info->set_is_directory(false); |
105 file_specific_info->set_content_mime_type(input.mime_type()); | 107 file_specific_info->set_content_mime_type(input.mime_type()); |
106 | 108 |
107 if (!input.alternate_link().is_empty()) | 109 if (!input.alternate_link().is_empty()) |
108 file_specific_info->set_alternate_url(input.alternate_link().spec()); | 110 file_specific_info->set_alternate_url(input.alternate_link().spec()); |
109 | 111 |
110 const int64 image_width = input.image_media_metadata().width(); | 112 const int64_t image_width = input.image_media_metadata().width(); |
111 if (image_width != -1) | 113 if (image_width != -1) |
112 file_specific_info->set_image_width(image_width); | 114 file_specific_info->set_image_width(image_width); |
113 | 115 |
114 const int64 image_height = input.image_media_metadata().height(); | 116 const int64_t image_height = input.image_media_metadata().height(); |
115 if (image_height != -1) | 117 if (image_height != -1) |
116 file_specific_info->set_image_height(image_height); | 118 file_specific_info->set_image_height(image_height); |
117 | 119 |
118 const int64 image_rotation = input.image_media_metadata().rotation(); | 120 const int64_t image_rotation = input.image_media_metadata().rotation(); |
119 if (image_rotation != -1) | 121 if (image_rotation != -1) |
120 file_specific_info->set_image_rotation(image_rotation); | 122 file_specific_info->set_image_rotation(image_rotation); |
121 } | 123 } |
122 | 124 |
123 out_entry->Swap(&converted); | 125 out_entry->Swap(&converted); |
124 swap(*out_parent_resource_id, parent_resource_id); | 126 swap(*out_parent_resource_id, parent_resource_id); |
125 return true; | 127 return true; |
126 } | 128 } |
127 | 129 |
128 void ConvertResourceEntryToFileInfo(const ResourceEntry& entry, | 130 void ConvertResourceEntryToFileInfo(const ResourceEntry& entry, |
129 base::File::Info* file_info) { | 131 base::File::Info* file_info) { |
130 file_info->size = entry.file_info().size(); | 132 file_info->size = entry.file_info().size(); |
131 file_info->is_directory = entry.file_info().is_directory(); | 133 file_info->is_directory = entry.file_info().is_directory(); |
132 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); | 134 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); |
133 file_info->last_modified = base::Time::FromInternalValue( | 135 file_info->last_modified = base::Time::FromInternalValue( |
134 entry.file_info().last_modified()); | 136 entry.file_info().last_modified()); |
135 file_info->last_accessed = base::Time::FromInternalValue( | 137 file_info->last_accessed = base::Time::FromInternalValue( |
136 entry.file_info().last_accessed()); | 138 entry.file_info().last_accessed()); |
137 file_info->creation_time = base::Time::FromInternalValue( | 139 file_info->creation_time = base::Time::FromInternalValue( |
138 entry.file_info().creation_time()); | 140 entry.file_info().creation_time()); |
139 } | 141 } |
140 | 142 |
141 } // namespace drive | 143 } // namespace drive |
OLD | NEW |