Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 517213002: [fsp] Move thumbnail logic to Drive specific C++ code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/thumbnail_loader.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/thumbnail_loader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698