OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 | 9 |
10 @class ChromeUILocalizer; | 10 @class ChromeUILocalizer; |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace gfx { | 28 namespace gfx { |
29 class FontList; | 29 class FontList; |
30 } | 30 } |
31 | 31 |
32 namespace ui { | 32 namespace ui { |
33 class MenuModel; | 33 class MenuModel; |
34 } | 34 } |
35 | 35 |
36 // A controller class that manages one download item. | 36 // A controller class that manages one download item. |
37 | 37 // |
| 38 // The view hierarchy is as follows: |
| 39 // |
| 40 // DownloadItemController |
| 41 // | |
| 42 // | A container that is showing one of its child views (progressView_ or |
| 43 // | dangerousDownloadView_) depending on whether the download is safe or not. |
| 44 // | |
| 45 // +-- progressView_ (instance of DownloadItemButton) |
| 46 // | | |
| 47 // | +-- cell_ (instance of DownloadItemCell) |
| 48 // | |
| 49 // +-- dangerousDownloadView_ |
| 50 // | |
| 51 // | Contains the dangerous download warning. Dependong on whether the |
| 52 // | download is dangerous (e.g. dangerous due to type of file), or |
| 53 // | malicious (e.g. downloaded from a known malware site) only one of |
| 54 // | dangerousButtonTweaker_ or maliciousButtonTweaker_ will be visible at |
| 55 // | one time. |
| 56 // | |
| 57 // +-- dangerousDownloadLabel_ |
| 58 // | |
| 59 // +-- image_ |
| 60 // | |
| 61 // +-- dangerousButtonTweaker_ |
| 62 // | |
| 63 // | Contains the 'Discard'/'Save' buttons for a dangerous download. This |
| 64 // | is a GTMWidthBasedTweaker that adjusts the width based on the text of |
| 65 // | buttons. |
| 66 // | |
| 67 // +-- maliciousButtonTweaker_ |
| 68 // |
| 69 // Contains the 'Discard' button and the drop down context menu button. |
| 70 // This is a GTMWidthBasedTweaker that adjusts the width based on the |
| 71 // text of the 'Discard' button. |
| 72 // |
38 @interface DownloadItemController : NSViewController { | 73 @interface DownloadItemController : NSViewController { |
39 @private | 74 @private |
40 IBOutlet DownloadItemButton* progressView_; | 75 IBOutlet DownloadItemButton* progressView_; |
41 IBOutlet DownloadItemCell* cell_; | 76 IBOutlet DownloadItemCell* cell_; |
42 | 77 |
43 // This is shown instead of progressView_ for dangerous downloads. | 78 // This is shown instead of progressView_ for dangerous downloads. |
44 IBOutlet NSView* dangerousDownloadView_; | 79 IBOutlet NSView* dangerousDownloadView_; |
45 IBOutlet NSTextField* dangerousDownloadLabel_; | 80 IBOutlet NSTextField* dangerousDownloadLabel_; |
46 IBOutlet NSButton* dangerousDownloadConfirmButton_; | 81 IBOutlet NSButton* dangerousDownloadConfirmButton_; |
47 | 82 |
(...skipping 16 matching lines...) Expand all Loading... |
64 // Weak pointer to the shelf that owns us. | 99 // Weak pointer to the shelf that owns us. |
65 DownloadShelfController* shelf_; | 100 DownloadShelfController* shelf_; |
66 | 101 |
67 // The time at which this view was created. | 102 // The time at which this view was created. |
68 base::Time creationTime_; | 103 base::Time creationTime_; |
69 | 104 |
70 // Default font list to use for text metrics. | 105 // Default font list to use for text metrics. |
71 scoped_ptr<gfx::FontList> font_list_; | 106 scoped_ptr<gfx::FontList> font_list_; |
72 | 107 |
73 // The state of this item. | 108 // The state of this item. |
74 enum DownoadItemState { | 109 enum DownloadItemState { |
75 kNormal, | 110 kNormal, |
76 kDangerous | 111 kDangerous |
77 } state_; | 112 } state_; |
78 | 113 |
79 // ExperienceSampling: This tracks dangerous/malicious downloads warning UI | 114 // ExperienceSampling: This tracks dangerous/malicious downloads warning UI |
80 // and the user's decisions about it. | 115 // and the user's decisions about it. |
81 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 116 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
82 }; | 117 }; |
83 | 118 |
84 // Initialize controller for |downloadItem|. | 119 // Initialize controller for |downloadItem|. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Updates the tooltip with the download's path. | 154 // Updates the tooltip with the download's path. |
120 - (void)updateToolTip; | 155 - (void)updateToolTip; |
121 | 156 |
122 // Handling of dangerous downloads | 157 // Handling of dangerous downloads |
123 - (void)clearDangerousMode; | 158 - (void)clearDangerousMode; |
124 - (BOOL)isDangerousMode; | 159 - (BOOL)isDangerousMode; |
125 - (IBAction)saveDownload:(id)sender; | 160 - (IBAction)saveDownload:(id)sender; |
126 - (IBAction)discardDownload:(id)sender; | 161 - (IBAction)discardDownload:(id)sender; |
127 - (IBAction)dismissMaliciousDownload:(id)sender; | 162 - (IBAction)dismissMaliciousDownload:(id)sender; |
128 - (IBAction)showContextMenu:(id)sender; | 163 - (IBAction)showContextMenu:(id)sender; |
| 164 |
129 @end | 165 @end |
OLD | NEW |