| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_ | 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_ | 6 #define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/status_icons/desktop_notification_balloon.h" | 9 #include "chrome/browser/status_icons/desktop_notification_balloon.h" |
| 10 #include "chrome/browser/status_icons/status_icon.h" | 10 #include "chrome/browser/status_icons/status_icon.h" |
| 11 #include "ui/views/linux_ui/status_icon_linux.h" | 11 #include "ui/views/linux_ui/status_icon_linux.h" |
| 12 | 12 |
| 13 // Wrapper class for StatusIconLinux that implements the standard StatusIcon | 13 // Wrapper class for StatusIconLinux that implements the standard StatusIcon |
| 14 // interface. Also handles callbacks from StatusIconLinux. | 14 // interface. Also handles callbacks from StatusIconLinux. |
| 15 class StatusIconLinuxWrapper : public StatusIcon, | 15 class StatusIconLinuxWrapper : public StatusIcon, |
| 16 public views::StatusIconLinux::Delegate, | 16 public views::StatusIconLinux::Delegate, |
| 17 public StatusIconMenuModel::Observer { | 17 public StatusIconMenuModel::Observer { |
| 18 public: | 18 public: |
| 19 virtual ~StatusIconLinuxWrapper(); | 19 virtual ~StatusIconLinuxWrapper(); |
| 20 | 20 |
| 21 // StatusIcon overrides: | 21 // StatusIcon overrides: |
| 22 virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE; | 22 virtual void SetImage(const gfx::ImageSkia& image) override; |
| 23 virtual void SetToolTip(const base::string16& tool_tip) OVERRIDE; | 23 virtual void SetToolTip(const base::string16& tool_tip) override; |
| 24 virtual void DisplayBalloon(const gfx::ImageSkia& icon, | 24 virtual void DisplayBalloon(const gfx::ImageSkia& icon, |
| 25 const base::string16& title, | 25 const base::string16& title, |
| 26 const base::string16& contents) OVERRIDE; | 26 const base::string16& contents) override; |
| 27 | 27 |
| 28 // StatusIconLinux::Delegate overrides: | 28 // StatusIconLinux::Delegate overrides: |
| 29 virtual void OnClick() OVERRIDE; | 29 virtual void OnClick() override; |
| 30 virtual bool HasClickAction() OVERRIDE; | 30 virtual bool HasClickAction() override; |
| 31 | 31 |
| 32 // StatusIconMenuModel::Observer overrides: | 32 // StatusIconMenuModel::Observer overrides: |
| 33 virtual void OnMenuStateChanged() OVERRIDE; | 33 virtual void OnMenuStateChanged() override; |
| 34 | 34 |
| 35 static StatusIconLinuxWrapper* CreateWrappedStatusIcon( | 35 static StatusIconLinuxWrapper* CreateWrappedStatusIcon( |
| 36 const gfx::ImageSkia& image, | 36 const gfx::ImageSkia& image, |
| 37 const base::string16& tool_tip); | 37 const base::string16& tool_tip); |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 // StatusIcon overrides: | 40 // StatusIcon overrides: |
| 41 // Invoked after a call to SetContextMenu() to let the platform-specific | 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 | 42 // subclass update the native context menu based on the new model. If NULL is |
| 43 // passed, subclass should destroy the native context menu. | 43 // passed, subclass should destroy the native context menu. |
| 44 virtual void UpdatePlatformContextMenu( | 44 virtual void UpdatePlatformContextMenu( |
| 45 StatusIconMenuModel* model) OVERRIDE; | 45 StatusIconMenuModel* model) override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // A status icon wrapper should only be created by calling | 48 // A status icon wrapper should only be created by calling |
| 49 // CreateWrappedStatusIcon(). | 49 // CreateWrappedStatusIcon(). |
| 50 explicit StatusIconLinuxWrapper(views::StatusIconLinux* status_icon); | 50 explicit StatusIconLinuxWrapper(views::StatusIconLinux* status_icon); |
| 51 | 51 |
| 52 // Notification balloon. | 52 // Notification balloon. |
| 53 DesktopNotificationBalloon notification_; | 53 DesktopNotificationBalloon notification_; |
| 54 | 54 |
| 55 scoped_ptr<views::StatusIconLinux> status_icon_; | 55 scoped_ptr<views::StatusIconLinux> status_icon_; |
| 56 | 56 |
| 57 StatusIconMenuModel* menu_model_; | 57 StatusIconMenuModel* menu_model_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(StatusIconLinuxWrapper); | 59 DISALLOW_COPY_AND_ASSIGN(StatusIconLinuxWrapper); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_LINUX_WRAPPER_H_ |
| OLD | NEW |