Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / libgtk2ui / app_indicator_icon.h
blob99da811bc0b63275a4a1aa62950d0ad17970a101
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_H_
8 #include "base/files/file_path.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
11 #include "ui/views/linux_ui/status_icon_linux.h"
13 typedef struct _AppIndicator AppIndicator;
14 typedef struct _GtkWidget GtkWidget;
16 namespace gfx {
17 class ImageSkia;
20 namespace ui {
21 class MenuModel;
24 namespace libgtk2ui {
26 class AppIndicatorIcon : public views::StatusIconLinux {
27 public:
28 // The id uniquely identifies the new status icon from other chrome status
29 // icons.
30 AppIndicatorIcon(std::string id,
31 const gfx::ImageSkia& image,
32 const base::string16& tool_tip);
33 virtual ~AppIndicatorIcon();
35 // Indicates whether libappindicator so could be opened.
36 static bool CouldOpen();
38 // Overridden from views::StatusIconLinux:
39 virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
40 virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
41 virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE;
42 virtual void UpdatePlatformContextMenu(ui::MenuModel* menu) OVERRIDE;
43 virtual void RefreshPlatformContextMenu() OVERRIDE;
45 private:
46 void SetImageFromFile(const base::FilePath& icon_file_path);
47 void SetMenu();
49 // Adds a menu item to the top of the existing gtk_menu as a replacement for
50 // the status icon click action or creates a new gtk menu with the menu item
51 // if a menu doesn't exist. Clicking on this menu item should simulate a
52 // status icon click by despatching a click event.
53 void CreateClickActionReplacement();
54 void DestroyMenu();
56 // Callback for when the status icon click replacement menu item is clicked.
57 CHROMEGTK_CALLBACK_0(AppIndicatorIcon, void, OnClick);
59 // Callback for when a menu item is clicked.
60 CHROMEGTK_CALLBACK_0(AppIndicatorIcon, void, OnMenuItemActivated);
62 std::string id_;
63 std::string tool_tip_;
65 // Gtk status icon wrapper
66 AppIndicator* icon_;
68 GtkWidget* gtk_menu_;
69 ui::MenuModel* menu_model_;
71 base::FilePath icon_file_path_;
72 int icon_change_count_;
73 bool block_activation_;
75 base::WeakPtrFactory<AppIndicatorIcon> weak_factory_;
77 DISALLOW_COPY_AND_ASSIGN(AppIndicatorIcon);
80 } // namespace libgtk2ui
82 #endif // CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_H_