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

Unified Diff: components/drive/service/drive_api_service.cc

Issue 2910913002: WIP.
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/drive/service/drive_api_service.h ('k') | components/drive/service/drive_service_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cb405b09f488e7f1f03b50cbdbcfc3d0ae76c3a4 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"
@@ -39,6 +40,7 @@ using google_apis::FileList;
using google_apis::FileListCallback;
using google_apis::FileResource;
using google_apis::FileResourceCallback;
+using google_apis::FilesListCorpora;
using google_apis::FilesListRequestRunner;
using google_apis::GetContentCallback;
using google_apis::GetShareUrlCallback;
@@ -346,16 +348,25 @@ 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_corpora(google_apis::CORPORA_ALL_TEAM_DRIVES);
+ }
return sender_->StartRequestWithAuthRetry(std::move(request));
}
CancelCallback DriveAPIService::GetFileListInDirectory(
const std::string& directory_resource_id,
+ const std::string& team_drive_id,
const FileListCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!directory_resource_id.empty());
DCHECK(!callback.is_null());
+ FilesListCorpora corpora = team_drive_id.empty()
+ ? google_apis::CORPORA_DEFAULT
+ : google_apis::CORPORA_TEAM_DRIVE;
+
// 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 +375,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, corpora, team_drive_id,
base::StringPrintf(
"'%s' in parents and trashed = false",
util::EscapeQueryStringValue(directory_resource_id).c_str()),
@@ -378,8 +389,13 @@ CancelCallback DriveAPIService::Search(
DCHECK(!search_query.empty());
DCHECK(!callback.is_null());
+ FilesListCorpora corpora = (google_apis::GetTeamDrivesIntegrationSwitch() ==
+ google_apis::TEAM_DRIVES_INTEGRATION_ENABLED)
+ ? google_apis::CORPORA_ALL_TEAM_DRIVES
+ : google_apis::CORPORA_DEFAULT;
+
return files_list_request_runner_->CreateAndStartWithSizeBackoff(
- kMaxNumFilesResourcePerRequestForSearch,
+ kMaxNumFilesResourcePerRequestForSearch, corpora, "",
util::TranslateQuery(search_query), kFileListFields, callback);
}
« no previous file with comments | « components/drive/service/drive_api_service.h ('k') | components/drive/service/drive_service_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698