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

Side by Side Diff: chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/gtk/download/download_shelf_context_menu_gtk.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/download/download_item_model.h"
9 #include "chrome/browser/ui/gtk/download/download_item_gtk.h"
10 #include "content/public/browser/page_navigator.h"
11 #include "ui/gfx/point.h"
12
13 DownloadShelfContextMenuGtk::DownloadShelfContextMenuGtk(
14 DownloadItemGtk* download_item,
15 content::PageNavigator* navigator)
16 : DownloadShelfContextMenu(download_item->download(), navigator),
17 download_item_gtk_(download_item) {
18 }
19
20 DownloadShelfContextMenuGtk::~DownloadShelfContextMenuGtk() {}
21
22 void DownloadShelfContextMenuGtk::Popup(GtkWidget* widget,
23 GdkEventButton* event) {
24 ui::SimpleMenuModel* menu_model = GetMenuModel();
25 // Popup() should never be called after the DownloadItem is destroyed.
26 DCHECK(menu_model);
27
28 menu_.reset(new MenuGtk(this, menu_model));
29
30 if (widget)
31 menu_->PopupForWidget(widget, event->button, event->time);
32 else
33 menu_->PopupAsContext(gfx::Point(event->x_root, event->y_root),
34 event->time);
35 }
36
37 void DownloadShelfContextMenuGtk::StoppedShowing() {
38 download_item_gtk_->menu_showing_ = false;
39 gtk_widget_queue_draw(download_item_gtk_->menu_button_);
40 }
41
42 GtkWidget* DownloadShelfContextMenuGtk::GetImageForCommandId(
43 int command_id) const {
44 const char* stock = NULL;
45 switch (command_id) {
46 case SHOW_IN_FOLDER:
47 case OPEN_WHEN_COMPLETE:
48 stock = GTK_STOCK_OPEN;
49 break;
50
51 case CANCEL:
52 stock = GTK_STOCK_CANCEL;
53 break;
54
55 case ALWAYS_OPEN_TYPE:
56 case TOGGLE_PAUSE:
57 stock = NULL;
58 break;
59
60 default:
61 NOTREACHED();
62 break;
63 }
64 return stock ? gtk_image_new_from_stock(stock, GTK_ICON_SIZE_MENU) : NULL;
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698