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_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_
6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/status_icons/desktop_notification_balloon.h"
10 #include "chrome/browser/status_icons/status_icon.h"
11 #include "ui/views/linux_ui/status_icon_linux.h"
13 // Wrapper class for StatusIconLinux that implements the standard StatusIcon
14 // interface. Also handles callbacks from StatusIconLinux.
15 class StatusIconLinuxWrapper
: public StatusIcon
,
16 public views::StatusIconLinux::Delegate
,
17 public StatusIconMenuModel::Observer
{
19 ~StatusIconLinuxWrapper() override
;
21 // StatusIcon overrides:
22 void SetImage(const gfx::ImageSkia
& image
) override
;
23 void SetToolTip(const base::string16
& tool_tip
) override
;
24 void DisplayBalloon(const gfx::ImageSkia
& icon
,
25 const base::string16
& title
,
26 const base::string16
& contents
) override
;
28 // StatusIconLinux::Delegate overrides:
29 void OnClick() override
;
30 bool HasClickAction() override
;
32 // StatusIconMenuModel::Observer overrides:
33 void OnMenuStateChanged() override
;
35 static StatusIconLinuxWrapper
* CreateWrappedStatusIcon(
36 const gfx::ImageSkia
& image
,
37 const base::string16
& tool_tip
);
40 // StatusIcon overrides:
41 // Invoked after a call to SetContextMenu() to let the platform-specific
42 // subclass update the native context menu based on the new model. If NULL is
43 // passed, subclass should destroy the native context menu.
44 void UpdatePlatformContextMenu(StatusIconMenuModel
* model
) override
;
47 // A status icon wrapper should only be created by calling
48 // CreateWrappedStatusIcon().
49 explicit StatusIconLinuxWrapper(views::StatusIconLinux
* status_icon
);
51 // Notification balloon.
52 DesktopNotificationBalloon notification_
;
54 scoped_ptr
<views::StatusIconLinux
> status_icon_
;
56 StatusIconMenuModel
* menu_model_
;
58 DISALLOW_COPY_AND_ASSIGN(StatusIconLinuxWrapper
);
61 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_