Commit a5fed04f authored by Hung Vu's avatar Hung Vu Committed by Commit Bot

Add new DialogType enum LOCATION_SUGGESTION and handle that case

Bug: 1118207
Change-Id: Ia6930c99bf0dac607450ddf97ee57cd3e09b9c44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391507Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Hung Vu <vuhung@google.com>
Cr-Commit-Position: refs/heads/master@{#804502}
parent 90efb7a4
...@@ -102,6 +102,12 @@ public class DownloadLocationCustomView ...@@ -102,6 +102,12 @@ public class DownloadLocationCustomView
case DownloadLocationDialogType.NAME_TOO_LONG: case DownloadLocationDialogType.NAME_TOO_LONG:
mSubtitleView.setText(R.string.download_location_name_too_long); mSubtitleView.setText(R.string.download_location_name_too_long);
break; break;
case DownloadLocationDialogType.LOCATION_SUGGESTION:
// TODO(vuhung): Add download and storage info to subtitle.
// Right now this subtitle is just a placeholder.
mSubtitleView.setText(DownloadUtils.getStringForBytes(getContext(), totalBytes));
break;
} }
mDirectoryAdapter.update(); mDirectoryAdapter.update();
......
...@@ -170,6 +170,7 @@ public class DownloadLocationDialogCoordinator implements ModalDialogProperties. ...@@ -170,6 +170,7 @@ public class DownloadLocationDialogCoordinator implements ModalDialogProperties.
case DownloadLocationDialogType.NAME_TOO_LONG: case DownloadLocationDialogType.NAME_TOO_LONG:
return mContext.getString(R.string.download_location_rename_file); return mContext.getString(R.string.download_location_rename_file);
case DownloadLocationDialogType.LOCATION_SUGGESTION: // Intentional fall through.
case DownloadLocationDialogType.DEFAULT: case DownloadLocationDialogType.DEFAULT:
return mContext.getString(R.string.download_location_dialog_title); return mContext.getString(R.string.download_location_dialog_title);
} }
......
...@@ -972,6 +972,14 @@ void ChromeDownloadManagerDelegate::RequestConfirmation( ...@@ -972,6 +972,14 @@ void ChromeDownloadManagerDelegate::RequestConfirmation(
// Figure out type of dialog and display. // Figure out type of dialog and display.
DownloadLocationDialogType dialog_type = DownloadLocationDialogType dialog_type =
DownloadLocationDialogType::DEFAULT; DownloadLocationDialogType::DEFAULT;
// Suggests an alternative location.
// TODO(vuhung): Conditions checking will be added in next CL.
if (base::FeatureList::IsEnabled(
download::features::kSmartSuggestionForLargeDownloads)) {
dialog_type = DownloadLocationDialogType::LOCATION_SUGGESTION;
}
switch (reason) { switch (reason) {
case DownloadConfirmationReason::TARGET_NO_SPACE: case DownloadConfirmationReason::TARGET_NO_SPACE:
dialog_type = DownloadLocationDialogType::LOCATION_FULL; dialog_type = DownloadLocationDialogType::LOCATION_FULL;
......
...@@ -17,7 +17,8 @@ enum class DownloadLocationDialogType { ...@@ -17,7 +17,8 @@ enum class DownloadLocationDialogType {
LOCATION_NOT_FOUND = 3, // Error dialog, default location is not found. LOCATION_NOT_FOUND = 3, // Error dialog, default location is not found.
NAME_CONFLICT = 4, // Error dialog, there is already a file with that name. NAME_CONFLICT = 4, // Error dialog, there is already a file with that name.
NAME_TOO_LONG = 5, // Error dialog, the file name is too long. NAME_TOO_LONG = 5, // Error dialog, the file name is too long.
kMaxValue = NAME_TOO_LONG LOCATION_SUGGESTION = 6, // Dialog showing alternative location suggestion.
kMaxValue = LOCATION_SUGGESTION
}; };
// Result of download location dialog. // Result of download location dialog.
......
...@@ -18669,6 +18669,7 @@ Called by update_document_policy_enum.py.--> ...@@ -18669,6 +18669,7 @@ Called by update_document_policy_enum.py.-->
<int value="3" label="LOCATION_NOT_FOUND"/> <int value="3" label="LOCATION_NOT_FOUND"/>
<int value="4" label="NAME_CONFLICT"/> <int value="4" label="NAME_CONFLICT"/>
<int value="5" label="NAME_TOO_LONG"/> <int value="5" label="NAME_TOO_LONG"/>
<int value="6" label="LOCATION_SUGGESTION"/>
</enum> </enum>
<enum name="DownloadLocationDirectoryType"> <enum name="DownloadLocationDirectoryType">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment