Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Side by Side Diff: chrome/browser/cocoa/download_item_mac.h

Issue 93129: Initial download shelf on OS X.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fix download_uitest Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/chrome/browser/gtk/download_item_gtk.h:r69-2775
Added: svn:eol-style
+ LF
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_GTK_DOWNLOAD_ITEM_GTK_H_ 5 #ifndef CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_MAC_H_
6 #define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ 6 #define CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_MAC_H_
7 7
8 #include <gtk/gtk.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/scoped_nsobject.h"
10 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
11 #include "chrome/browser/download/download_manager.h" 12 #include "chrome/browser/download/download_manager.h"
12 13
13 class BaseDownloadItemModel; 14 class BaseDownloadItemModel;
14 class DownloadShelfContextMenuGtk; 15 @class DownloadShelfController;
15 class NineBox; 16 @class DownloadShelfContextMenuBridge;
16 17
17 class DownloadItemGtk : DownloadItem::Observer { 18
19 // A class that bridges the visible mac download items to chromium's
20 // download model.
21
22 class DownloadItemMac : DownloadItem::Observer {
18 public: 23 public:
19 // DownloadItemGtk takes ownership of |download_item_model|. 24 // DownloadItemMac takes ownership of |download_item_model|.
20 DownloadItemGtk(BaseDownloadItemModel* download_item_model, 25 DownloadItemMac(BaseDownloadItemModel* download_item_model,
21 GtkWidget* parent_shelf, GtkWidget* bounding_widget); 26 NSRect frame,
27 DownloadShelfController* parent);
22 28
23 // We put |hbox_| in |parent_shelf| and rely on |parent_shelf| recursively 29 // Destructor.
24 // destroying its children. Hence we do nothing in the destructor. 30 ~DownloadItemMac();
25 ~DownloadItemGtk();
26 31
27 // DownloadItem::Observer implementation 32 // DownloadItem::Observer implementation
28 virtual void OnDownloadUpdated(DownloadItem* download); 33 virtual void OnDownloadUpdated(DownloadItem* download);
34 virtual void OnDownloadOpened(DownloadItem* download) { }
29 35
30 private: 36 private:
31 static void InitNineBoxes();
32
33 static gboolean OnExpose(GtkWidget* widget, GdkEventExpose* e,
34 DownloadItemGtk* download_item);
35
36 static gboolean OnMenuButtonPressEvent(GtkWidget* button,
37 GdkEvent* event,
38 DownloadItemGtk* item);
39
40 static void OnShelfResized(GtkWidget *widget,
41 GtkAllocation *allocation,
42 DownloadItemGtk* item);
43
44 // Nineboxes for the body area.
45 static NineBox* body_nine_box_normal_;
46 static NineBox* body_nine_box_prelight_;
47 static NineBox* body_nine_box_active_;
48
49 // Nineboxes for the menu button.
50 static NineBox* menu_nine_box_normal_;
51 static NineBox* menu_nine_box_prelight_;
52 static NineBox* menu_nine_box_active_;
53
54 // The widget that contains the body and menu dropdown.
55 GtkWidget* hbox_;
56
57 // The widget that contains the name of the download and the progress
58 // animation.
59 GtkWidget* body_;
60
61 // The GtkLabel that holds the status text.
62 GtkWidget* status_label_;
63
64 // The widget that creates a dropdown menu when pressed.
65 GtkWidget* menu_button_;
66
67 // The menu that pops down when the user presses |menu_button_|. We do not
68 // create this until the first time we actually need it.
69 scoped_ptr<DownloadShelfContextMenuGtk> menu_;
70
71 // The download item model we represent. 37 // The download item model we represent.
72 scoped_ptr<BaseDownloadItemModel> download_model_; 38 scoped_ptr<BaseDownloadItemModel> download_model_;
73 39
74 // The shelf we show ourselves on. We do not own this widget. 40 // Our parent view
75 GtkWidget* parent_shelf_; 41 DownloadShelfController* parent_; // weak
76 42
77 // This is the leftmost widget on |parent_shelf_| that is not a download item. 43 // Context menu
78 // We do not want to overlap it. 44 scoped_nsobject<DownloadShelfContextMenuBridge> menu_;
79 GtkWidget* bounding_widget_;
80 }; 45 };
81 46
82 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ 47 #endif // CHROME_BROWSER_COCOA_DOWNLOAD_ITEM_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.mm ('k') | chrome/browser/cocoa/download_item_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698