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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Gets parent Resource ID. On drive.google.com, a file can have multiple | 59 // Gets parent Resource ID. On drive.google.com, a file can have multiple |
60 // parents or no parent, but we are forcing a tree-shaped structure (i.e. no | 60 // parents or no parent, but we are forcing a tree-shaped structure (i.e. no |
61 // multi-parent or zero-parent entries). Therefore the first found "parent" is | 61 // multi-parent or zero-parent entries). Therefore the first found "parent" is |
62 // used for the entry. Tracked in http://crbug.com/158904. | 62 // used for the entry. Tracked in http://crbug.com/158904. |
63 std::string parent_resource_id; | 63 std::string parent_resource_id; |
64 if (!input.parents().empty()) | 64 if (!input.parents().empty()) |
65 parent_resource_id = input.parents()[0].file_id(); | 65 parent_resource_id = input.parents()[0].file_id(); |
66 | 66 |
67 converted.set_deleted(input.labels().is_trashed()); | 67 converted.set_deleted(input.labels().is_trashed()); |
| 68 converted.set_starred(input.labels().is_starred()); |
68 converted.set_shared_with_me(!input.shared_with_me_date().is_null()); | 69 converted.set_shared_with_me(!input.shared_with_me_date().is_null()); |
69 converted.set_shared(input.shared()); | 70 converted.set_shared(input.shared()); |
70 | 71 |
71 PlatformFileInfoProto* file_info = converted.mutable_file_info(); | 72 PlatformFileInfoProto* file_info = converted.mutable_file_info(); |
72 | 73 |
73 file_info->set_last_modified(input.modified_date().ToInternalValue()); | 74 file_info->set_last_modified(input.modified_date().ToInternalValue()); |
74 // If the file has never been viewed (last_viewed_by_me_date().is_null() == | 75 // If the file has never been viewed (last_viewed_by_me_date().is_null() == |
75 // true), then we will set the last_accessed field in the protocol buffer to | 76 // true), then we will set the last_accessed field in the protocol buffer to |
76 // 0. | 77 // 0. |
77 file_info->set_last_accessed( | 78 file_info->set_last_accessed( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); | 135 file_info->is_symbolic_link = entry.file_info().is_symbolic_link(); |
135 file_info->last_modified = base::Time::FromInternalValue( | 136 file_info->last_modified = base::Time::FromInternalValue( |
136 entry.file_info().last_modified()); | 137 entry.file_info().last_modified()); |
137 file_info->last_accessed = base::Time::FromInternalValue( | 138 file_info->last_accessed = base::Time::FromInternalValue( |
138 entry.file_info().last_accessed()); | 139 entry.file_info().last_accessed()); |
139 file_info->creation_time = base::Time::FromInternalValue( | 140 file_info->creation_time = base::Time::FromInternalValue( |
140 entry.file_info().creation_time()); | 141 entry.file_info().creation_time()); |
141 } | 142 } |
142 | 143 |
143 } // namespace drive | 144 } // namespace drive |
OLD | NEW |