OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_GTK2_STATUS_ICON_H_ | |
6 #define CHROME_BROWSER_UI_LIBGTK2UI_GTK2_STATUS_ICON_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/strings/string16.h" | |
12 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" | |
13 #include "ui/base/glib/glib_integers.h" | |
14 #include "ui/base/glib/glib_signal.h" | |
15 #include "ui/views/linux_ui/status_icon_linux.h" | |
16 | |
17 typedef struct _GtkStatusIcon GtkStatusIcon; | |
18 | |
19 namespace gfx { | |
20 class ImageSkia; | |
21 } | |
22 | |
23 namespace ui { | |
24 class MenuModel; | |
25 } | |
26 | |
27 namespace libgtk2ui { | |
28 class AppIndicatorIconMenu; | |
29 | |
30 // Status icon implementation which uses the system tray X11 spec (via | |
31 // GtkStatusIcon). | |
32 class Gtk2StatusIcon : public views::StatusIconLinux { | |
33 public: | |
34 Gtk2StatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); | |
35 ~Gtk2StatusIcon() override; | |
36 | |
37 // Overridden from views::StatusIconLinux: | |
38 void SetImage(const gfx::ImageSkia& image) override; | |
39 void SetToolTip(const base::string16& tool_tip) override; | |
40 void UpdatePlatformContextMenu(ui::MenuModel* menu) override; | |
41 void RefreshPlatformContextMenu() override; | |
42 | |
43 private: | |
44 CHROMEG_CALLBACK_0(Gtk2StatusIcon, void, OnClick, GtkStatusIcon*); | |
45 | |
46 CHROMEG_CALLBACK_2(Gtk2StatusIcon, | |
47 void, | |
48 OnContextMenuRequested, | |
49 GtkStatusIcon*, | |
50 guint, | |
51 guint); | |
52 | |
53 GtkStatusIcon* gtk_status_icon_; | |
54 | |
55 std::unique_ptr<AppIndicatorIconMenu> menu_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(Gtk2StatusIcon); | |
58 }; | |
59 | |
60 } // namespace libgtk2ui | |
61 | |
62 #endif // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_STATUS_ICON_H_ | |
OLD | NEW |