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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 properties->file_size.reset(new double(file_info.size())); | 69 properties->file_size.reset(new double(file_info.size())); |
70 properties->last_modified_time.reset(new double( | 70 properties->last_modified_time.reset(new double( |
71 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); | 71 base::Time::FromInternalValue(file_info.last_modified()).ToJsTime())); |
72 | 72 |
73 if (!entry_proto.has_file_specific_info()) | 73 if (!entry_proto.has_file_specific_info()) |
74 return; | 74 return; |
75 | 75 |
76 const drive::FileSpecificInfo& file_specific_info = | 76 const drive::FileSpecificInfo& file_specific_info = |
77 entry_proto.file_specific_info(); | 77 entry_proto.file_specific_info(); |
78 | 78 |
79 // The web thumbnail is used only when the file is not present. Otherwise | 79 if (!entry_proto.resource_id().empty()) { |
80 // it could be out of sync. | |
81 if (!entry_proto.resource_id().empty() && | |
82 !file_specific_info.cache_state().is_present()) { | |
83 properties->thumbnail_url.reset( | 80 properties->thumbnail_url.reset( |
mtomasz
2014/09/17 09:29:48
AFAIR, the check for is_present() was done by @hir
yoshiki
2014/09/17 09:57:09
The generated thumbnail has higher priority and th
| |
84 new std::string("https://www.googledrive.com/thumb/" + | 81 new std::string("https://www.googledrive.com/thumb/" + |
85 entry_proto.resource_id() + "?width=500&height=500")); | 82 entry_proto.resource_id() + "?width=500&height=500")); |
86 } | 83 } |
87 if (file_specific_info.has_image_width()) { | 84 if (file_specific_info.has_image_width()) { |
88 properties->image_width.reset( | 85 properties->image_width.reset( |
89 new int(file_specific_info.image_width())); | 86 new int(file_specific_info.image_width())); |
90 } | 87 } |
91 if (file_specific_info.has_image_height()) { | 88 if (file_specific_info.has_image_height()) { |
92 properties->image_height.reset( | 89 properties->image_height.reset( |
93 new int(file_specific_info.image_height())); | 90 new int(file_specific_info.image_height())); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1032 return; | 1029 return; |
1033 } | 1030 } |
1034 | 1031 |
1035 const std::string url = download_url_ + "?access_token=" + access_token; | 1032 const std::string url = download_url_ + "?access_token=" + access_token; |
1036 SetResult(new base::StringValue(url)); | 1033 SetResult(new base::StringValue(url)); |
1037 | 1034 |
1038 SendResponse(true); | 1035 SendResponse(true); |
1039 } | 1036 } |
1040 | 1037 |
1041 } // namespace extensions | 1038 } // namespace extensions |
OLD | NEW |