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

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

Issue 2693093002: Fetch file metadata of files under Team Drives. (Closed)
Patch Set: Rename the enum to TeamDrivesIntegrationStatus to be more descriptive. Created 3 years, 10 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 | components/drive/service/drive_api_service.cc » ('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 <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 20 matching lines...) Expand all
31 #include "chromeos/chromeos_switches.h" 31 #include "chromeos/chromeos_switches.h"
32 #include "chromeos/network/network_handler.h" 32 #include "chromeos/network/network_handler.h"
33 #include "chromeos/network/network_state_handler.h" 33 #include "chromeos/network/network_state_handler.h"
34 #include "components/drive/drive_app_registry.h" 34 #include "components/drive/drive_app_registry.h"
35 #include "components/drive/event_logger.h" 35 #include "components/drive/event_logger.h"
36 #include "components/signin/core/browser/profile_oauth2_token_service.h" 36 #include "components/signin/core/browser/profile_oauth2_token_service.h"
37 #include "components/signin/core/browser/signin_manager.h" 37 #include "components/signin/core/browser/signin_manager.h"
38 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
39 #include "google_apis/drive/auth_service.h" 39 #include "google_apis/drive/auth_service.h"
40 #include "google_apis/drive/drive_api_url_generator.h" 40 #include "google_apis/drive/drive_api_url_generator.h"
41 #include "google_apis/drive/drive_switches.h"
41 #include "storage/common/fileapi/file_system_info.h" 42 #include "storage/common/fileapi/file_system_info.h"
42 #include "storage/common/fileapi/file_system_util.h" 43 #include "storage/common/fileapi/file_system_util.h"
43 #include "url/gurl.h" 44 #include "url/gurl.h"
44 45
45 using content::BrowserThread; 46 using content::BrowserThread;
46 47
47 using chromeos::file_system_provider::EntryMetadata; 48 using chromeos::file_system_provider::EntryMetadata;
48 using chromeos::file_system_provider::ProvidedFileSystemInterface; 49 using chromeos::file_system_provider::ProvidedFileSystemInterface;
49 using chromeos::file_system_provider::util::FileSystemURLParser; 50 using chromeos::file_system_provider::util::FileSystemURLParser;
50 using extensions::api::file_manager_private::EntryProperties; 51 using extensions::api::file_manager_private::EntryProperties;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (!entry_proto.has_file_specific_info()) 94 if (!entry_proto.has_file_specific_info())
94 return; 95 return;
95 96
96 const drive::FileSpecificInfo& file_specific_info = 97 const drive::FileSpecificInfo& file_specific_info =
97 entry_proto.file_specific_info(); 98 entry_proto.file_specific_info();
98 99
99 if (!entry_proto.resource_id().empty()) { 100 if (!entry_proto.resource_id().empty()) {
100 DriveApiUrlGenerator url_generator( 101 DriveApiUrlGenerator url_generator(
101 (GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction)), 102 (GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction)),
102 (GURL(google_apis::DriveApiUrlGenerator:: 103 (GURL(google_apis::DriveApiUrlGenerator::
103 kBaseThumbnailUrlForProduction))); 104 kBaseThumbnailUrlForProduction)),
105 google_apis::GetTeamDrivesIntegrationSwitch());
104 properties->thumbnail_url.reset(new std::string( 106 properties->thumbnail_url.reset(new std::string(
105 url_generator.GetThumbnailUrl(entry_proto.resource_id(), 107 url_generator.GetThumbnailUrl(entry_proto.resource_id(),
106 500 /* width */, 500 /* height */, 108 500 /* width */, 500 /* height */,
107 false /* not cropped */).spec())); 109 false /* not cropped */).spec()));
108 properties->cropped_thumbnail_url.reset(new std::string( 110 properties->cropped_thumbnail_url.reset(new std::string(
109 url_generator.GetThumbnailUrl( 111 url_generator.GetThumbnailUrl(
110 entry_proto.resource_id(), 112 entry_proto.resource_id(),
111 kFileManagerMaximumThumbnailDimension /* width */, 113 kFileManagerMaximumThumbnailDimension /* width */,
112 kFileManagerMaximumThumbnailDimension /* height */, 114 kFileManagerMaximumThumbnailDimension /* height */,
113 true /* cropped */).spec())); 115 true /* cropped */).spec()));
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 SetError("Download Url for this item is not available."); 1109 SetError("Download Url for this item is not available.");
1108 // Intentionally returns a blank. 1110 // Intentionally returns a blank.
1109 SetResult(base::MakeUnique<base::StringValue>(std::string())); 1111 SetResult(base::MakeUnique<base::StringValue>(std::string()));
1110 SendResponse(false); 1112 SendResponse(false);
1111 return; 1113 return;
1112 } 1114 }
1113 1115
1114 DriveApiUrlGenerator url_generator( 1116 DriveApiUrlGenerator url_generator(
1115 (GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction)), 1117 (GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction)),
1116 (GURL( 1118 (GURL(
1117 google_apis::DriveApiUrlGenerator::kBaseThumbnailUrlForProduction))); 1119 google_apis::DriveApiUrlGenerator::kBaseThumbnailUrlForProduction)),
1120 google_apis::GetTeamDrivesIntegrationSwitch());
1118 download_url_ = url_generator.GenerateDownloadFileUrl(entry->resource_id()); 1121 download_url_ = url_generator.GenerateDownloadFileUrl(entry->resource_id());
1119 1122
1120 ProfileOAuth2TokenService* oauth2_token_service = 1123 ProfileOAuth2TokenService* oauth2_token_service =
1121 ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile()); 1124 ProfileOAuth2TokenServiceFactory::GetForProfile(GetProfile());
1122 SigninManagerBase* signin_manager = 1125 SigninManagerBase* signin_manager =
1123 SigninManagerFactory::GetForProfile(GetProfile()); 1126 SigninManagerFactory::GetForProfile(GetProfile());
1124 const std::string& account_id = signin_manager->GetAuthenticatedAccountId(); 1127 const std::string& account_id = signin_manager->GetAuthenticatedAccountId();
1125 std::vector<std::string> scopes; 1128 std::vector<std::string> scopes;
1126 scopes.push_back("https://www.googleapis.com/auth/drive.readonly"); 1129 scopes.push_back("https://www.googleapis.com/auth/drive.readonly");
1127 1130
(...skipping 18 matching lines...) Expand all
1146 } 1149 }
1147 1150
1148 const std::string url = 1151 const std::string url =
1149 download_url_.Resolve("?alt=media&access_token=" + access_token).spec(); 1152 download_url_.Resolve("?alt=media&access_token=" + access_token).spec();
1150 SetResult(base::MakeUnique<base::StringValue>(url)); 1153 SetResult(base::MakeUnique<base::StringValue>(url));
1151 1154
1152 SendResponse(true); 1155 SendResponse(true);
1153 } 1156 }
1154 1157
1155 } // namespace extensions 1158 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | components/drive/service/drive_api_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698