OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // A view that implements one download on the Download shelf. | 5 // A view that implements one download on the Download shelf. |
6 // Each DownloadItemViewMd contains an application icon, a text label | 6 // Each DownloadItemViewMd contains an application icon, a text label |
7 // indicating the download's file name, a text label indicating the | 7 // indicating the download's file name, a text label indicating the |
8 // download's status (such as the number of bytes downloaded so far) | 8 // download's status (such as the number of bytes downloaded so far) |
9 // and a button for canceling an in progress download, or opening | 9 // and a button for canceling an in progress download, or opening |
10 // the completed download. | 10 // the completed download. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 void HandleClickEvent(const ui::LocatedEvent& event, bool active_event); | 168 void HandleClickEvent(const ui::LocatedEvent& event, bool active_event); |
169 | 169 |
170 // Sets the state and triggers a repaint. | 170 // Sets the state and triggers a repaint. |
171 void SetDropdownState(State new_state); | 171 void SetDropdownState(State new_state); |
172 | 172 |
173 // Whether we are in the dangerous mode. | 173 // Whether we are in the dangerous mode. |
174 bool IsShowingWarningDialog() const { | 174 bool IsShowingWarningDialog() const { |
175 return mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE; | 175 return mode_ == DANGEROUS_MODE || mode_ == MALICIOUS_MODE; |
176 } | 176 } |
177 | 177 |
| 178 // Clears or shows the warning dialog as per the state of |model_|. |
| 179 void ToggleWarningDialog(); |
| 180 |
178 // Reverts from dangerous mode to normal download mode. | 181 // Reverts from dangerous mode to normal download mode. |
179 void ClearWarningDialog(); | 182 void ClearWarningDialog(); |
180 | 183 |
181 // Start displaying the dangerous download warning or the malicious download | 184 // Start displaying the dangerous download warning or the malicious download |
182 // warning. | 185 // warning. |
183 void ShowWarningDialog(); | 186 void ShowWarningDialog(); |
184 | 187 |
185 // Returns the current warning icon (should only be called when the view is | 188 // Returns the current warning icon (should only be called when the view is |
186 // actually showing a warning). | 189 // actually showing a warning). |
187 gfx::ImageSkia GetWarningIcon(); | 190 gfx::ImageSkia GetWarningIcon(); |
(...skipping 18 matching lines...) Expand all Loading... |
206 // so that screenreaders can access the filename, status text, and | 209 // so that screenreaders can access the filename, status text, and |
207 // dangerous download warning message (if any). | 210 // dangerous download warning message (if any). |
208 void UpdateAccessibleName(); | 211 void UpdateAccessibleName(); |
209 | 212 |
210 // Show/Hide/Reset |animation| based on the state transition specified by | 213 // Show/Hide/Reset |animation| based on the state transition specified by |
211 // |from| and |to|. | 214 // |from| and |to|. |
212 void AnimateStateTransition(State from, | 215 void AnimateStateTransition(State from, |
213 State to, | 216 State to, |
214 gfx::SlideAnimation* animation); | 217 gfx::SlideAnimation* animation); |
215 | 218 |
| 219 // Callback for |progress_timer_|. |
| 220 void ProgressTimerFired(); |
| 221 |
216 // Returns the base text color. | 222 // Returns the base text color. |
217 SkColor GetTextColor(); | 223 SkColor GetTextColor(); |
218 | 224 |
219 // Returns a slightly dimmed version of the base text color. | 225 // Returns a slightly dimmed version of the base text color. |
220 SkColor GetDimmedTextColor(); | 226 SkColor GetDimmedTextColor(); |
221 | 227 |
222 // The download shelf that owns us. | 228 // The download shelf that owns us. |
223 DownloadShelfView* shelf_; | 229 DownloadShelfView* shelf_; |
224 | 230 |
225 // Elements of our particular download | 231 // Elements of our particular download |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 320 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
315 | 321 |
316 // Method factory used to delay reenabling of the item when opening the | 322 // Method factory used to delay reenabling of the item when opening the |
317 // downloaded file. | 323 // downloaded file. |
318 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; | 324 base::WeakPtrFactory<DownloadItemViewMd> weak_ptr_factory_; |
319 | 325 |
320 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); | 326 DISALLOW_COPY_AND_ASSIGN(DownloadItemViewMd); |
321 }; | 327 }; |
322 | 328 |
323 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ | 329 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_MD_H_ |
OLD | NEW |