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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 ResourceEntry* out_entry, | 22 ResourceEntry* out_entry, |
23 std::string* out_parent_resource_id) { | 23 std::string* out_parent_resource_id) { |
24 DCHECK(out_entry); | 24 DCHECK(out_entry); |
25 DCHECK(out_parent_resource_id); | 25 DCHECK(out_parent_resource_id); |
26 | 26 |
27 ResourceEntry converted; | 27 ResourceEntry converted; |
28 std::string parent_resource_id; | 28 std::string parent_resource_id; |
29 if (input.file() && | 29 if (input.file() && |
30 !ConvertFileResourceToResourceEntry(*input.file(), &converted, | 30 !ConvertFileResourceToResourceEntry(*input.file(), &converted, |
31 &parent_resource_id)) | 31 &parent_resource_id)) |
32 return false; | 32 return false; |
33 | 33 |
34 converted.set_resource_id(input.file_id()); | 34 converted.set_resource_id(input.file_id()); |
35 converted.set_deleted(converted.deleted() || input.is_deleted()); | 35 converted.set_deleted(converted.deleted() || input.is_deleted()); |
36 converted.set_modification_date(input.modification_date().ToInternalValue()); | 36 converted.set_modification_date(input.modification_date().ToInternalValue()); |
37 | 37 |
38 out_entry->Swap(&converted); | 38 out_entry->Swap(&converted); |
39 swap(*out_parent_resource_id, parent_resource_id); | 39 swap(*out_parent_resource_id, parent_resource_id); |
40 return true; | 40 return true; |
41 } | 41 } |
42 | 42 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 file_info->is_directory = entry.file_info().is_directory(); | 134 file_info->is_directory = entry.file_info().is_directory(); |
135 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); | 135 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); |
136 file_info->last_modified = base::Time::FromInternalValue( | 136 file_info->last_modified = base::Time::FromInternalValue( |
137 entry.file_info().last_modified()); | 137 entry.file_info().last_modified()); |
138 file_info->last_accessed = base::Time::FromInternalValue( | 138 file_info->last_accessed = base::Time::FromInternalValue( |
139 entry.file_info().last_accessed()); | 139 entry.file_info().last_accessed()); |
140 file_info->creation_time = base::Time::FromInternalValue( | 140 file_info->creation_time = base::Time::FromInternalValue( |
141 entry.file_info().creation_time()); | 141 entry.file_info().creation_time()); |
142 } | 142 } |
143 | 143 |
| 144 bool ConvertChangeResourceToTeamDriveChange( |
| 145 const google_apis::ChangeResource& input, |
| 146 TeamDriveChange* out_entry) { |
| 147 DCHECK(out_entry); |
| 148 DCHECK_EQ(google_apis::ChangeResource::TEAM_DRIVE, input.type()); |
| 149 |
| 150 TeamDriveChange converted; |
| 151 if (!input.team_drive()) { |
| 152 LOG(ERROR) << "team_drive field is empty"; |
| 153 return false; |
| 154 } |
| 155 |
| 156 converted.set_name(input.team_drive()->name()); |
| 157 converted.set_id(input.team_drive()->id()); |
| 158 converted.set_modification_date(input.modification_date().ToInternalValue()); |
| 159 out_entry->Swap(&converted); |
| 160 return true; |
| 161 } |
| 162 |
144 } // namespace drive | 163 } // namespace drive |
OLD | NEW |