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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 properties->file_size.reset(new double(file_info.size())); | 64 properties->file_size.reset(new double(file_info.size())); |
65 properties->last_modified_time.reset(new double( | 65 properties->last_modified_time.reset(new double( |
66 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); | 66 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); |
67 | 67 |
68 if (!entry_proto.has_file_specific_info()) | 68 if (!entry_proto.has_file_specific_info()) |
69 return; | 69 return; |
70 | 70 |
71 const drive::FileSpecificInfo& file_specific_info = | 71 const drive::FileSpecificInfo& file_specific_info = |
72 entry_proto.file_specific_info(); | 72 entry_proto.file_specific_info(); |
73 | 73 |
74 if (!entry_proto.resource_id().empty()) { | 74 // The web thumbnail is used only when the file is not present. Otherwise |
| 75 // it could be out of sync. |
| 76 if (!entry_proto.resource_id().empty() && |
| 77 !file_specific_info.cache_state().is_present()) { |
75 properties->thumbnail_url.reset( | 78 properties->thumbnail_url.reset( |
76 new std::string("https://www.googledrive.com/thumb/" + | 79 new std::string("https://www.googledrive.com/thumb/" + |
77 entry_proto.resource_id() + "?width=500&height=500")); | 80 entry_proto.resource_id() + "?width=500&height=500")); |
78 } | 81 } |
79 if (file_specific_info.has_image_width()) { | 82 if (file_specific_info.has_image_width()) { |
80 properties->image_width.reset( | 83 properties->image_width.reset( |
81 new int(file_specific_info.image_width())); | 84 new int(file_specific_info.image_width())); |
82 } | 85 } |
83 if (file_specific_info.has_image_height()) { | 86 if (file_specific_info.has_image_height()) { |
84 properties->image_height.reset( | 87 properties->image_height.reset( |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 return; | 978 return; |
976 } | 979 } |
977 | 980 |
978 const std::string url = download_url_ + "?access_token=" + access_token; | 981 const std::string url = download_url_ + "?access_token=" + access_token; |
979 SetResult(new base::StringValue(url)); | 982 SetResult(new base::StringValue(url)); |
980 | 983 |
981 SendResponse(true); | 984 SendResponse(true); |
982 } | 985 } |
983 | 986 |
984 } // namespace extensions | 987 } // namespace extensions |
OLD | NEW |