OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
17 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 18 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 #include "ui/base/gtk/gtk_signal.h" | 21 #include "ui/base/gtk/gtk_signal.h" |
21 #include "ui/base/gtk/owned_widget_gtk.h" | 22 #include "ui/base/gtk/owned_widget_gtk.h" |
22 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
(...skipping 12 matching lines...) Expand all Loading... |
35 class DownloadShelfGtk : public DownloadShelf, | 36 class DownloadShelfGtk : public DownloadShelf, |
36 public content::NotificationObserver, | 37 public content::NotificationObserver, |
37 public SlideAnimatorGtk::Delegate, | 38 public SlideAnimatorGtk::Delegate, |
38 public MessageLoopForUI::Observer { | 39 public MessageLoopForUI::Observer { |
39 public: | 40 public: |
40 DownloadShelfGtk(Browser* browser, gfx::NativeView view); | 41 DownloadShelfGtk(Browser* browser, gfx::NativeView view); |
41 | 42 |
42 virtual ~DownloadShelfGtk(); | 43 virtual ~DownloadShelfGtk(); |
43 | 44 |
44 // DownloadShelf implementation. | 45 // DownloadShelf implementation. |
45 virtual void AddDownload(BaseDownloadItemModel* download_model); | 46 virtual void AddDownload(BaseDownloadItemModel* download_model) OVERRIDE; |
46 virtual bool IsShowing() const; | 47 virtual bool IsShowing() const OVERRIDE; |
47 virtual bool IsClosing() const; | 48 virtual bool IsClosing() const OVERRIDE; |
48 virtual void Show(); | 49 virtual void Show() OVERRIDE; |
49 virtual void Close(); | 50 virtual void Close() OVERRIDE; |
50 virtual Browser* browser() const; | 51 virtual Browser* browser() const OVERRIDE; |
51 | 52 |
52 // SlideAnimatorGtk::Delegate implementation. | 53 // SlideAnimatorGtk::Delegate implementation. |
53 virtual void Closed(); | 54 virtual void Closed() OVERRIDE; |
54 | 55 |
55 // Overridden from content::NotificationObserver: | 56 // Overridden from content::NotificationObserver: |
56 virtual void Observe(int type, | 57 virtual void Observe(int type, |
57 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
58 const content::NotificationDetails& details); | 59 const content::NotificationDetails& details) OVERRIDE; |
59 | 60 |
60 // Returns the current height of the shelf. | 61 // Returns the current height of the shelf. |
61 int GetHeight() const; | 62 int GetHeight() const; |
62 | 63 |
63 // MessageLoop::Observer implementation: | 64 // MessageLoop::Observer implementation: |
64 virtual void WillProcessEvent(GdkEvent* event); | 65 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE; |
65 virtual void DidProcessEvent(GdkEvent* event); | 66 virtual void DidProcessEvent(GdkEvent* event) OVERRIDE; |
66 | 67 |
67 private: | 68 private: |
68 // Remove |download_item| from the download shelf and delete it. | 69 // Remove |download_item| from the download shelf and delete it. |
69 void RemoveDownloadItem(DownloadItemGtk* download_item); | 70 void RemoveDownloadItem(DownloadItemGtk* download_item); |
70 | 71 |
71 // Get the hbox download items ought to pack themselves into. | 72 // Get the hbox download items ought to pack themselves into. |
72 GtkWidget* GetHBox() const; | 73 GtkWidget* GetHBox() const; |
73 | 74 |
74 // Show more hidden download items if there is enough space in the shelf. | 75 // Show more hidden download items if there is enough space in the shelf. |
75 // It's called when a download item is removed from the shelf or an item's | 76 // It's called when a download item is removed from the shelf or an item's |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // True if the mouse is within the shelf's bounds, as of the last mouse event | 144 // True if the mouse is within the shelf's bounds, as of the last mouse event |
144 // we received. | 145 // we received. |
145 bool mouse_in_shelf_; | 146 bool mouse_in_shelf_; |
146 | 147 |
147 base::WeakPtrFactory<DownloadShelfGtk> weak_factory_; | 148 base::WeakPtrFactory<DownloadShelfGtk> weak_factory_; |
148 | 149 |
149 friend class DownloadItemGtk; | 150 friend class DownloadItemGtk; |
150 }; | 151 }; |
151 | 152 |
152 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ | 153 #endif // CHROME_BROWSER_UI_GTK_DOWNLOAD_DOWNLOAD_SHELF_GTK_H_ |
OLD | NEW |