Index: chrome/browser/ui/views/download/download_item_view.h |
diff --git a/chrome/browser/ui/views/download/download_item_view.h b/chrome/browser/ui/views/download/download_item_view.h |
index e190e60a353b71475638cb44555db967be9de253..f84d7626261552a8f23b0a99718703899aeb5400 100644 |
--- a/chrome/browser/ui/views/download/download_item_view.h |
+++ b/chrome/browser/ui/views/download/download_item_view.h |
@@ -109,8 +109,13 @@ class DownloadItemView : public views::ButtonListener, |
enum State { |
NORMAL = 0, |
HOT, |
- PUSHED, |
- DANGEROUS |
+ PUSHED |
+ }; |
+ |
+ enum Mode { |
+ NORMAL_MODE = 0, // Showing download item. |
+ DANGEROUS_MODE, // Displaying the dangerous download warning. |
+ MALICIOUS_MODE // Displaying the malicious download warning. |
}; |
// The image set associated with the part containing the icon and text. |
@@ -153,13 +158,16 @@ class DownloadItemView : public views::ButtonListener, |
void SetState(State body_state, State drop_down_state); |
// Whether we are in the dangerous mode. |
- bool IsDangerousMode() { return body_state_ == DANGEROUS; } |
+ bool IsShowingWarningDialog() { |
+ return mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE; |
+ } |
// Reverts from dangerous mode to normal download mode. |
- void ClearDangerousMode(); |
+ void ClearWarningDialog(); |
- // Start displaying the dangerous download warning. |
- void EnterDangerousMode(); |
+ // Start displaying the dangerous download warning or the malicious download |
+ // warning. |
+ void ShowWarningDialog(); |
// Sets |size| with the size of the Save and Discard buttons (they have the |
// same size). |
@@ -174,6 +182,9 @@ class DownloadItemView : public views::ButtonListener, |
// open the downloaded file. |
void Reenable(); |
+ // Releases drop down button after showing a context menu. |
+ void ReleaseDropDown(); |
+ |
// Given |x|, returns whether |x| is within the x coordinate range of |
// the drop-down button or not. |
bool InDropDownButtonXCoordinateRange(int x); |
@@ -183,11 +194,15 @@ class DownloadItemView : public views::ButtonListener, |
// dangerous download warning message (if any). |
void UpdateAccessibleName(); |
+ // Update the location of the drop down button. |
+ void UpdateDropDownButtonPosition(); |
+ |
// The different images used for the background. |
BodyImageSet normal_body_image_set_; |
BodyImageSet hot_body_image_set_; |
BodyImageSet pushed_body_image_set_; |
BodyImageSet dangerous_mode_body_image_set_; |
+ BodyImageSet malicious_mode_body_image_set_; |
DropDownImageSet normal_drop_down_image_set_; |
DropDownImageSet hot_drop_down_image_set_; |
DropDownImageSet pushed_drop_down_image_set_; |
@@ -214,6 +229,9 @@ class DownloadItemView : public views::ButtonListener, |
State body_state_; |
State drop_down_state_; |
+ // Mode of the download item view. |
+ Mode mode_; |
+ |
// In degrees, for downloads with no known total size. |
int progress_angle_; |
@@ -278,7 +296,7 @@ class DownloadItemView : public views::ButtonListener, |
// Method factory used to delay reenabling of the item when opening the |
// downloaded file. |
- base::WeakPtrFactory<DownloadItemView> reenable_method_factory_; |
+ base::WeakPtrFactory<DownloadItemView> weak_ptr_factory_; |
// The currently running download context menu. |
scoped_ptr<DownloadShelfContextMenuView> context_menu_; |