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 UI_LINUX_UI_STATUS_ICON_LINUX_H_ 6 #define UI_LINUX_UI_STATUS_ICON_LINUX_H_ 7 8 #include "base/strings/string16.h" 9 #include "ui/linux_ui/linux_ui_export.h" 10 11 namespace gfx { 12 class ImageSkia; 13 } 14 15 namespace ui { 16 class MenuModel; 17 } // namespace ui 18 19 // Since liblinux_ui cannot have dependencies on any chrome browser components 20 // we cannot inherit from StatusIcon. So we implement the necessary methods 21 // and let a wrapper class implement the StatusIcon interface and defer the 22 // callbacks to a delegate. 23 class LINUX_UI_EXPORT StatusIconLinux { 24 public: 25 class Delegate { 26 public: 27 virtual void OnClick() = 0; 28 virtual bool HasClickAction() = 0; 29 30 protected: 31 virtual ~Delegate(); 32 }; 33 34 StatusIconLinux(); 35 virtual ~StatusIconLinux(); 36 37 virtual void SetImage(const gfx::ImageSkia& image) = 0; 38 virtual void SetPressedImage(const gfx::ImageSkia& image) = 0; 39 virtual void SetToolTip(const string16& tool_tip) = 0; 40 41 // Invoked after a call to SetContextMenu() to let the platform-specific 42 // subclass update the native context menu based on the new model. The 43 // subclass should destroy the existing native context menu on this call. 44 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) = 0; 45 46 Delegate* delegate() { return delegate_; } 47 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 48 49 private: 50 Delegate* delegate_; 51 }; 52 53 #endif // UI_LINUX_UI_STATUS_ICON_LINUX_H_ 54