| Index: components/drive/service/drive_api_service.cc
|
| diff --git a/components/drive/service/drive_api_service.cc b/components/drive/service/drive_api_service.cc
|
| index 89672e6c0c491e595d97ebeb54b43f31c986971a..9240130e34b1f25a4341aebfb1e4e675bf3365eb 100644
|
| --- a/components/drive/service/drive_api_service.cc
|
| +++ b/components/drive/service/drive_api_service.cc
|
| @@ -17,6 +17,7 @@
|
| #include "google_apis/drive/base_requests.h"
|
| #include "google_apis/drive/drive_api_parser.h"
|
| #include "google_apis/drive/drive_api_requests.h"
|
| +#include "google_apis/drive/drive_switches.h"
|
| #include "google_apis/drive/files_list_request_runner.h"
|
| #include "google_apis/drive/request_sender.h"
|
| #include "google_apis/google_api_keys.h"
|
| @@ -34,6 +35,7 @@ using google_apis::DRIVE_OTHER_ERROR;
|
| using google_apis::DRIVE_PARSE_ERROR;
|
| using google_apis::DownloadActionCallback;
|
| using google_apis::DriveApiErrorCode;
|
| +using google_apis::FilesListScope;
|
| using google_apis::EntryActionCallback;
|
| using google_apis::FileList;
|
| using google_apis::FileListCallback;
|
| @@ -346,6 +348,10 @@ CancelCallback DriveAPIService::GetAllFileList(
|
| request->set_max_results(kMaxNumFilesResourcePerRequest);
|
| request->set_q("trashed = false"); // Exclude trashed files.
|
| request->set_fields(kFileListFields);
|
| + if (google_apis::GetTeamDrivesIntegrationSwitch() ==
|
| + google_apis::TEAM_DRIVES_INTEGRATION_ENABLED) {
|
| + request->set_scope(google_apis::FilesListScope::kAllTeamDrives);
|
| + }
|
| return sender_->StartRequestWithAuthRetry(std::move(request));
|
| }
|
|
|
| @@ -356,6 +362,14 @@ CancelCallback DriveAPIService::GetFileListInDirectory(
|
| DCHECK(!directory_resource_id.empty());
|
| DCHECK(!callback.is_null());
|
|
|
| + // TODO(yamaguchi): Use FileListScope::CreateForTeamDrive instead of
|
| + // kAllTeamDrives for efficiency. It'll require to add a new parameter to tell
|
| + // which team drive the directory resource belongs to.
|
| + FilesListScope scope = (google_apis::GetTeamDrivesIntegrationSwitch() ==
|
| + google_apis::TEAM_DRIVES_INTEGRATION_ENABLED)
|
| + ? FilesListScope::kAllTeamDrives
|
| + : FilesListScope::kDefault;
|
| +
|
| // Because children.list method on Drive API v2 returns only the list of
|
| // children's references, but we need all file resource list.
|
| // So, here we use files.list method instead, with setting parents query.
|
| @@ -364,7 +378,7 @@ CancelCallback DriveAPIService::GetFileListInDirectory(
|
| // to client side.
|
| // We aren't interested in files in trash in this context, neither.
|
| return files_list_request_runner_->CreateAndStartWithSizeBackoff(
|
| - kMaxNumFilesResourcePerRequest,
|
| + kMaxNumFilesResourcePerRequest, scope,
|
| base::StringPrintf(
|
| "'%s' in parents and trashed = false",
|
| util::EscapeQueryStringValue(directory_resource_id).c_str()),
|
| @@ -378,8 +392,13 @@ CancelCallback DriveAPIService::Search(
|
| DCHECK(!search_query.empty());
|
| DCHECK(!callback.is_null());
|
|
|
| + FilesListScope scope = (google_apis::GetTeamDrivesIntegrationSwitch() ==
|
| + google_apis::TEAM_DRIVES_INTEGRATION_ENABLED)
|
| + ? FilesListScope::kAllTeamDrives
|
| + : FilesListScope::kDefault;
|
| +
|
| return files_list_request_runner_->CreateAndStartWithSizeBackoff(
|
| - kMaxNumFilesResourcePerRequestForSearch,
|
| + kMaxNumFilesResourcePerRequestForSearch, scope,
|
| util::TranslateQuery(search_query), kFileListFields, callback);
|
| }
|
|
|
|
|