OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/file_manager/private_api_drive.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
8 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 8 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
9 #include "chrome/browser/chromeos/file_manager/file_tasks.h" | 9 #include "chrome/browser/chromeos/file_manager/file_tasks.h" |
10 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 10 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const char kDriveConnectionReasonNoNetwork[] = "no_network"; | 42 const char kDriveConnectionReasonNoNetwork[] = "no_network"; |
43 const char kDriveConnectionReasonNoService[] = "no_service"; | 43 const char kDriveConnectionReasonNoService[] = "no_service"; |
44 | 44 |
45 // Copies properties from |entry_proto| to |properties|. | 45 // Copies properties from |entry_proto| to |properties|. |
46 void FillDriveEntryPropertiesValue( | 46 void FillDriveEntryPropertiesValue( |
47 const drive::ResourceEntry& entry_proto, | 47 const drive::ResourceEntry& entry_proto, |
48 api::file_browser_private::DriveEntryProperties* properties) { | 48 api::file_browser_private::DriveEntryProperties* properties) { |
49 properties->shared_with_me.reset(new bool(entry_proto.shared_with_me())); | 49 properties->shared_with_me.reset(new bool(entry_proto.shared_with_me())); |
50 properties->shared.reset(new bool(entry_proto.shared())); | 50 properties->shared.reset(new bool(entry_proto.shared())); |
51 | 51 |
| 52 const drive::PlatformFileInfoProto& file_info = entry_proto.file_info(); |
| 53 properties->file_size.reset(new double(file_info.size())); |
| 54 properties->last_modified_time.reset(new double( |
| 55 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); |
| 56 |
52 if (!entry_proto.has_file_specific_info()) | 57 if (!entry_proto.has_file_specific_info()) |
53 return; | 58 return; |
54 | 59 |
55 const drive::FileSpecificInfo& file_specific_info = | 60 const drive::FileSpecificInfo& file_specific_info = |
56 entry_proto.file_specific_info(); | 61 entry_proto.file_specific_info(); |
57 | |
58 properties->thumbnail_url.reset( | 62 properties->thumbnail_url.reset( |
59 new std::string("https://www.googledrive.com/thumb/" + | 63 new std::string("https://www.googledrive.com/thumb/" + |
60 entry_proto.resource_id() + "?width=500&height=500")); | 64 entry_proto.resource_id() + "?width=500&height=500")); |
61 if (file_specific_info.has_image_width()) { | 65 if (file_specific_info.has_image_width()) { |
62 properties->image_width.reset( | 66 properties->image_width.reset( |
63 new int(file_specific_info.image_width())); | 67 new int(file_specific_info.image_width())); |
64 } | 68 } |
65 if (file_specific_info.has_image_height()) { | 69 if (file_specific_info.has_image_height()) { |
66 properties->image_height.reset( | 70 properties->image_height.reset( |
67 new int(file_specific_info.image_height())); | 71 new int(file_specific_info.image_height())); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 SetError("Share Url for this item is not available."); | 676 SetError("Share Url for this item is not available."); |
673 SendResponse(false); | 677 SendResponse(false); |
674 return; | 678 return; |
675 } | 679 } |
676 | 680 |
677 SetResult(new base::StringValue(share_url.spec())); | 681 SetResult(new base::StringValue(share_url.spec())); |
678 SendResponse(true); | 682 SendResponse(true); |
679 } | 683 } |
680 | 684 |
681 } // namespace extensions | 685 } // namespace extensions |
OLD | NEW |