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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/private_api_util.cc

Issue 22523003: Enable Google Drive in all save-file dialogs of Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix Created 7 years, 4 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 | « no previous file | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
index be35838e8b98fd0d2299d244be541b8838f18eb7..39327eac8e6b19f3ac098b7151390893905b3db2 100644
--- a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc
@@ -48,19 +48,17 @@ void ContinueGetSelectedFileInfo(Profile* profile,
void GetSelectedFileInfoInternal(Profile* profile,
scoped_ptr<GetSelectedFileInfoParams> params) {
DCHECK(profile);
+ drive::DriveIntegrationService* integration_service =
+ drive::DriveIntegrationServiceFactory::GetForProfile(profile);
for (size_t i = params->selected_files.size();
i < params->file_paths.size(); ++i) {
const base::FilePath& file_path = params->file_paths[i];
- // When the caller of the select file dialog wants local file paths,
- // we should retrieve Drive files onto the local cache.
- if (params->local_path_option == NO_LOCAL_PATH_RESOLUTION ||
- !drive::util::IsUnderDriveMountPoint(file_path)) {
+
+ if (!drive::util::IsUnderDriveMountPoint(file_path)) {
params->selected_files.push_back(
ui::SelectedFileInfo(file_path, base::FilePath()));
} else {
- drive::DriveIntegrationService* integration_service =
- drive::DriveIntegrationServiceFactory::GetForProfile(profile);
// |integration_service| is NULL if Drive is disabled.
if (!integration_service) {
ContinueGetSelectedFileInfo(profile,
@@ -70,15 +68,29 @@ void GetSelectedFileInfoInternal(Profile* profile,
scoped_ptr<drive::ResourceEntry>());
return;
}
- // TODO(kinaba): crbug.com/140425 support FOR_SAVING
- DCHECK(params->local_path_option == NEED_LOCAL_PATH_FOR_OPENING);
- integration_service->file_system()->GetFileByPath(
- drive::util::ExtractDrivePath(file_path),
- base::Bind(&ContinueGetSelectedFileInfo,
- profile,
- base::Passed(&params)));
- return;
- }
+ // When the caller of the select file dialog wants local file paths,
+ // we should retrieve Drive files onto the local cache.
+ switch (params->local_path_option) {
+ case NO_LOCAL_PATH_RESOLUTION:
+ params->selected_files.push_back(
+ ui::SelectedFileInfo(file_path, base::FilePath()));
+ break;
+ case NEED_LOCAL_PATH_FOR_OPENING:
+ integration_service->file_system()->GetFileByPath(
+ drive::util::ExtractDrivePath(file_path),
+ base::Bind(&ContinueGetSelectedFileInfo,
+ profile,
+ base::Passed(&params)));
+ return; // Remaining work is done in ContinueGetSelectedFileInfo.
+ case NEED_LOCAL_PATH_FOR_SAVING:
+ integration_service->file_system()->GetFileByPathForSaving(
+ drive::util::ExtractDrivePath(file_path),
+ base::Bind(&ContinueGetSelectedFileInfo,
+ profile,
+ base::Passed(&params)));
+ return; // Remaining work is done in ContinueGetSelectedFileInfo.
+ }
+ }
}
params->callback.Run(params->selected_files);
}
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698