15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_GTK_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_GTK_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <gtk/gtk.h>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/weak_ptr.h"
15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/time/time.h"
16eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/timer/timer.h"
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/download/download_item_model.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/icon_manager.h"
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/common/cancelable_task_tracker.h"
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/download_item.h"
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_registrar.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/gtk/gtk_signal.h"
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/gtk/owned_widget_gtk.h"
25d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/animation_delegate.h"
26d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/slide_animation.h"
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DownloadShelfContextMenuGtk;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DownloadShelfGtk;
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GtkThemeService;
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class NineBox;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace gfx {
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Image;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SlideAnimation;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DownloadItemGtk : public content::DownloadItem::Observer,
39d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)                        public gfx::AnimationDelegate,
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                        public content::NotificationObserver {
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // DownloadItemGtk takes ownership of |download_item_model|.
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DownloadItemGtk(DownloadShelfGtk* parent_shelf,
442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                  content::DownloadItem* download_item);
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Destroys all widgets belonging to this DownloadItemGtk.
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~DownloadItemGtk();
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // content::DownloadItem::Observer implementation.
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
54d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // gfx::AnimationDelegate implementation.
55d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from content::NotificationObserver:
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Observe(int type,
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const content::NotificationSource& source,
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       const content::NotificationDetails& details) OVERRIDE;
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when the icon manager has finished loading the icon. We take
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ownership of |icon_bitmap|.
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void OnLoadSmallIconComplete(gfx::Image* image);
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void OnLoadLargeIconComplete(gfx::Image* image);
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the DownloadItem model object belonging to this item.
682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  content::DownloadItem* download() { return download_model_.download(); }
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  friend class DownloadShelfContextMenuGtk;
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Functions for controlling the progress animation.
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Repaint the download progress.
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateDownloadProgress();
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Starts a repeating timer for UpdateDownloadProgress.
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void StartDownloadProgress();
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Stops the repeating timer.
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void StopDownloadProgress();
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ask the icon manager to asynchronously start loading the icon for the file.
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LoadIcon();
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the tooltip on the download button.
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateTooltip();
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the name label to the correct color.
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateNameLabel();
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the text of |status_label_| with the correct color.
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateStatusLabel(const std::string& status_text);
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the components of the danger warning.
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateDangerWarning();
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Sets the icon for the danger warning dialog.
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateDangerIcon();
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Reenables the download button after it has been clicked.
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ReenableHbox();
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static void InitNineBoxes();
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Show popup context menu. If |button| is not NULL, show the menu dropping
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // down from |button|. Otherwise, show the menu where the user clicks.
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ShowPopupMenu(GtkWidget* button, GdkEventButton* event);
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Draws everything in GTK rendering mode.
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnHboxExpose,
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       GdkEventExpose*);
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used for the download item's body and menu button in chrome theme mode.
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnExpose, GdkEventExpose*);
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when |body_| is clicked.
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnClick);
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called when |body_| is pressed with mouse button. This function is used to
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // show popup menu with right button click.
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnButtonPress,
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       GdkEventButton*);
1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used for the download icon.
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnProgressAreaExpose,
1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       GdkEventExpose*);
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnMenuButtonPressEvent,
1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       GdkEventButton*);
1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Dangerous download related. -----------------------------------------------
1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_1(DownloadItemGtk, gboolean, OnDangerousPromptExpose,
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                       GdkEventExpose*);
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousAccept);
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  CHROMEGTK_CALLBACK_0(DownloadItemGtk, void, OnDangerousDecline);
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Nineboxes for the body area.
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* body_nine_box_normal_;
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* body_nine_box_prelight_;
1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* body_nine_box_active_;
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Nineboxes for the menu button.
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* menu_nine_box_normal_;
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* menu_nine_box_prelight_;
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* menu_nine_box_active_;
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Ninebox for the background of the dangerous download prompt.
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static NineBox* dangerous_nine_box_;
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The shelf on which we are displayed.
1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DownloadShelfGtk* parent_shelf_;
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The widget that contains the body and menu dropdown.
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ui::OwnedWidgetGtk hbox_;
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The widget that contains the name of the download and the progress
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // animation.
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ui::OwnedWidgetGtk body_;
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The widget that contains the texts of |name_label_| and |status_label_|.
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* text_stack_;
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The GtkLabel that holds the download title text.
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* name_label_;
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The GtkLabel that holds the status text.
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* status_label_;
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The current text of status label
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::string status_text_;
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The widget that creates a dropdown menu when pressed.
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* menu_button_;
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A gtk arrow pointing downward displayed in |menu_button_|. Only displayed
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in GTK mode.
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* arrow_;
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether the menu is currently showing for |menu_button_|. Affects how we
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // draw the button.
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool menu_showing_;
1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether we should use the GTK text color
1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkThemeService* theme_service_;
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The widget that contains the animation progress and the file's icon
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // (as well as the complete animation).
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ui::OwnedWidgetGtk progress_area_;
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // In degrees. Only used for downloads with no known total size.
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int progress_angle_;
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The menu that pops down when the user presses |menu_button_|. We do not
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // create this until the first time we actually need it.
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<DownloadShelfContextMenuGtk> menu_;
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The download item model we represent.
1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  DownloadItemModel download_model_;
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The dangerous download dialog. This will be null for safe downloads.
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* dangerous_prompt_;
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* dangerous_image_;
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GtkWidget* dangerous_label_;
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // An hbox for holding components of the dangerous download dialog.
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ui::OwnedWidgetGtk dangerous_hbox_;
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int dangerous_hbox_start_width_;
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int dangerous_hbox_full_width_;
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The animation when this item is first added to the shelf.
212d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  scoped_ptr<gfx::SlideAnimation> new_item_animation_;
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Progress animation.
2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::RepeatingTimer<DownloadItemGtk> progress_timer_;
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Animation for download complete.
218d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  gfx::SlideAnimation complete_animation_;
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The file icon for the download. May be null. The small version is used
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // for display in the shelf; the large version is for use as a drag icon.
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These icons are owned by the IconManager (owned by the BrowserProcess).
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::Image* icon_small_;
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::Image* icon_large_;
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The last download file path for which we requested an icon.
2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  base::FilePath icon_filepath_;
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  content::NotificationRegistrar registrar_;
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The time at which we were insantiated.
2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::Time creation_time_;
2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // For canceling an in progress icon request.
2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  CancelableTaskTracker cancelable_task_tracker_;
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Indicates when the download has completed, so we don't redo
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // on-completion actions.
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool download_complete_;
2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Whether we are currently disabled as part of opening the downloaded file.
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool disabled_while_opening_;
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Method factory used to delay reenabling of the item when opening the
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // downloaded file.
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::WeakPtrFactory<DownloadItemGtk> weak_ptr_factory_;
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_ITEM_GTK_H_
250