Commit ffd2ebc2 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Small cleanups for DownloadItemView::Mode.

* Convert enum -> enum class
* Rename values for consistency and clarity
* Rename/modify helpers for brevity and clarity
* Move values and helpers to .cc to keep .h shorter
* Use helpers more consistently

Bug: none
Change-Id: I12987b7c7dd8dd4589bbada0f23688309ece95fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2256362
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781921}
parent 9adcfb10
...@@ -62,6 +62,8 @@ class DownloadItemView : public views::View, ...@@ -62,6 +62,8 @@ class DownloadItemView : public views::View,
public DownloadUIModel::Observer, public DownloadUIModel::Observer,
public views::AnimationDelegateViews { public views::AnimationDelegateViews {
public: public:
enum class Mode;
DownloadItemView(DownloadUIModel::DownloadUIModelPtr download, DownloadItemView(DownloadUIModel::DownloadUIModelPtr download,
DownloadShelfView* parent, DownloadShelfView* parent,
views::View* accessible_alert); views::View* accessible_alert);
...@@ -109,16 +111,6 @@ class DownloadItemView : public views::View, ...@@ -109,16 +111,6 @@ class DownloadItemView : public views::View,
private: private:
enum State { NORMAL = 0, HOT, PUSHED }; enum State { NORMAL = 0, HOT, PUSHED };
enum Mode {
NORMAL_MODE = 0, // Showing download item.
DANGEROUS_MODE, // Displaying the dangerous download warning.
MALICIOUS_MODE, // Displaying the malicious download warning.
DEEP_SCANNING_MODE, // Displaying information about in progress deep
// scanning.
MIX_DL_WARNING_MODE, // Displaying the mixed-content download warning.
MIX_DL_BLOCK_MODE, // Displaying the mixed-content download block error.
};
static constexpr int kTextWidth = 140; static constexpr int kTextWidth = 140;
// Padding before the icon and at end of the item. // Padding before the icon and at end of the item.
...@@ -166,19 +158,6 @@ class DownloadItemView : public views::View, ...@@ -166,19 +158,6 @@ class DownloadItemView : public views::View,
void SetMode(Mode mode); void SetMode(Mode mode);
// Whether we are in the dangerous mode.
bool IsShowingWarningDialog() const {
return mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE;
}
// Whether we are in the mixed content mode.
bool IsShowingMixedContentDialog() const {
return mode_ == MIX_DL_WARNING_MODE || mode_ == MIX_DL_BLOCK_MODE;
}
// Whether we are in the deep scanning mode.
bool IsShowingDeepScanning() const { return mode_ == DEEP_SCANNING_MODE; }
// Starts showing the normal mode dialog, clearing the existing dialog. // Starts showing the normal mode dialog, clearing the existing dialog.
void TransitionToNormalMode(); void TransitionToNormalMode();
......
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