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(¶ms))); |
- 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(¶ms))); |
+ 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(¶ms))); |
+ return; // Remaining work is done in ContinueGetSelectedFileInfo. |
+ } |
+ } |
} |
params->callback.Run(params->selected_files); |
} |