Home | History | Annotate | Download | only in status_icons
      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.
      4 
      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_
      7 
      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/linux_ui/linux_ui.h"
     12 
     13 // Wrapper class for StatusIconLinux that implements the standard StatusIcon
     14 // interface. Also handles callbacks from StatusIconLinux.
     15 class StatusIconLinuxWrapper : public StatusIcon,
     16                                public StatusIconLinux::Delegate {
     17  public:
     18   virtual ~StatusIconLinuxWrapper();
     19 
     20   // StatusIcon overrides:
     21   virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
     22   virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
     23   virtual void SetToolTip(const string16& tool_tip) OVERRIDE;
     24   virtual void DisplayBalloon(const gfx::ImageSkia& icon,
     25                               const string16& title,
     26                               const string16& contents) OVERRIDE;
     27 
     28   // StatusIconLinux::Delegate overrides:
     29   virtual void OnClick() OVERRIDE;
     30   virtual bool HasClickAction() OVERRIDE;
     31 
     32   static StatusIconLinuxWrapper* CreateWrappedStatusIcon(
     33       const gfx::ImageSkia& image,
     34       const string16& tool_tip);
     35 
     36  protected:
     37   // StatusIcon overrides:
     38   // Invoked after a call to SetContextMenu() to let the platform-specific
     39   // subclass update the native context menu based on the new model. If NULL is
     40   // passed, subclass should destroy the native context menu.
     41   virtual void UpdatePlatformContextMenu(ui::MenuModel* model) OVERRIDE;
     42 
     43  private:
     44   // A status icon wrapper should only be created by calling
     45   // CreateWrappedStatusIcon().
     46   explicit StatusIconLinuxWrapper(StatusIconLinux* status_icon);
     47 
     48   // Notification balloon.
     49   DesktopNotificationBalloon notification_;
     50   scoped_ptr<StatusIconLinux> status_icon_;
     51 
     52   DISALLOW_COPY_AND_ASSIGN(StatusIconLinuxWrapper);
     53 };
     54 
     55 #endif  // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_
     56