blob: 80d7b85bef5106dbc027c5ee677aa0fcb6d8b364 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_
#define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_
#include <gtk/gtk.h>
#include <vector>
#include "base/gfx/native_widget_types.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/owned_widget_gtk.h"
class BaseDownloadItemModel;
class Browser;
class CustomDrawButton;
class DownloadItemGtk;
class GtkThemeProvider;
class SlideAnimatorGtk;
class DownloadShelfGtk : public DownloadShelf,
public NotificationObserver {
public:
explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view);
~DownloadShelfGtk();
// DownloadShelf implementation.
virtual void AddDownload(BaseDownloadItemModel* download_model);
virtual bool IsShowing() const;
virtual bool IsClosing() const;
virtual void Show();
virtual void Close();
virtual Browser* browser() const { return browser_; }
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
// Returns the current height of the shelf.
int GetHeight() const;
private:
// Remove |download_item| from the download shelf and delete it.
void RemoveDownloadItem(DownloadItemGtk* download_item);
// Get the leftmost non-download item widget on the shelf.
GtkWidget* GetRightBoundingWidget() const;
// Get the hbox download items ought to pack themselves into.
GtkWidget* GetHBox() const;
static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar);
// The browser that owns this download shelf.
Browser* browser_;
// The top level widget of the shelf.
scoped_ptr<SlideAnimatorGtk> slide_widget_;
// |hbox_| holds the download items and buttons of the shelf.
OwnedWidgetGtk hbox_;
// |shelf_| is the second highest level widget. See the constructor
// for an explanation of the widget layout.
OwnedWidgetGtk shelf_;
// A GtkEventBox which we color.
GtkWidget* padding_bg_;
// This hbox holds the link text and download icon. It also holds the
// distinction of being the leftmost non-download item widget on the shelf.
GtkWidget* link_hbox_;
// The 'x' that the user can press to hide the download shelf.
scoped_ptr<CustomDrawButton> close_button_;
// Keeps track of our current hide/show state.
bool is_showing_;
// The download items we have added to our shelf.
std::vector<DownloadItemGtk*> download_items_;
// Gives us our colors and theme information.
GtkThemeProvider* theme_provider_;
NotificationRegistrar registrar_;
friend class DownloadItemGtk;
};
#endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_
|