| 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 "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 5 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 PlatformFileInfoProto* file_info = output.mutable_file_info(); | 66 PlatformFileInfoProto* file_info = output.mutable_file_info(); |
| 67 | 67 |
| 68 file_info->set_last_modified(input.updated_time().ToInternalValue()); | 68 file_info->set_last_modified(input.updated_time().ToInternalValue()); |
| 69 // If the file has never been viewed (last_viewed_time().is_null() == true), | 69 // If the file has never been viewed (last_viewed_time().is_null() == true), |
| 70 // then we will set the last_accessed field in the protocol buffer to 0. | 70 // then we will set the last_accessed field in the protocol buffer to 0. |
| 71 file_info->set_last_accessed(input.last_viewed_time().ToInternalValue()); | 71 file_info->set_last_accessed(input.last_viewed_time().ToInternalValue()); |
| 72 file_info->set_creation_time(input.published_time().ToInternalValue()); | 72 file_info->set_creation_time(input.published_time().ToInternalValue()); |
| 73 | 73 |
| 74 if (input.is_file() || input.is_hosted_document()) { | 74 if (input.is_file() || input.is_hosted_document()) { |
| 75 DriveFileSpecificInfo* file_specific_info = | 75 FileSpecificInfo* file_specific_info = output.mutable_file_specific_info(); |
| 76 output.mutable_file_specific_info(); | |
| 77 if (input.is_file()) { | 76 if (input.is_file()) { |
| 78 file_info->set_size(input.file_size()); | 77 file_info->set_size(input.file_size()); |
| 79 file_specific_info->set_file_md5(input.file_md5()); | 78 file_specific_info->set_file_md5(input.file_md5()); |
| 80 | 79 |
| 81 // The resumable-edit-media link should only be present for regular | 80 // The resumable-edit-media link should only be present for regular |
| 82 // files as hosted documents are not uploadable. | 81 // files as hosted documents are not uploadable. |
| 83 } else if (input.is_hosted_document()) { | 82 } else if (input.is_hosted_document()) { |
| 84 // Attach .g<something> extension to hosted documents so we can special | 83 // Attach .g<something> extension to hosted documents so we can special |
| 85 // case their handling in UI. | 84 // case their handling in UI. |
| 86 // TODO(satorux): Figure out better way how to pass input info like kind | 85 // TODO(satorux): Figure out better way how to pass input info like kind |
| (...skipping 24 matching lines...) Expand all Loading... |
| 111 file_info->set_is_directory(true); | 110 file_info->set_is_directory(true); |
| 112 } else { | 111 } else { |
| 113 // Some resource entries don't map into files (i.e. sites). | 112 // Some resource entries don't map into files (i.e. sites). |
| 114 return ResourceEntry(); | 113 return ResourceEntry(); |
| 115 } | 114 } |
| 116 | 115 |
| 117 return output; | 116 return output; |
| 118 } | 117 } |
| 119 | 118 |
| 120 } // namespace drive | 119 } // namespace drive |
| OLD | NEW |