Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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 | |
| 10 namespace gfx { | |
| 11 class ImageSkia; | |
| 12 } | |
| 13 | |
| 14 namespace ui { | |
| 15 class MenuModel; | |
| 16 } // namespace ui | |
| 17 | |
| 18 // Since liblinux_ui cannot have dependencies on any chrome browser components | |
| 19 // we cannot inherit from StatusIcon. So we implement the necessary methods | |
| 20 // and let a wrapper class implement the StatusIcon interface and defer the | |
| 21 // callbacks to a delegate. | |
| 22 class StatusIconLinux { | |
| 23 public: | |
| 24 class Delegate { | |
| 25 public: | |
| 26 virtual void OnClick() = 0; | |
| 27 }; | |
|
sky
2013/07/15 20:41:10
Add a protected virtual destructor.
sidharthms
2013/07/16 01:12:05
Done.
| |
| 28 | |
| 29 virtual ~StatusIconLinux() {} | |
| 30 | |
| 31 virtual void SetImage(const gfx::ImageSkia& image) = 0; | |
| 32 virtual void SetPressedImage(const gfx::ImageSkia& image) = 0; | |
| 33 virtual void SetToolTip(const string16& tool_tip) = 0; | |
| 34 virtual void SetClickActionLabel(const string16& label) = 0; | |
| 35 | |
| 36 // Invoked after a call to SetContextMenu() to let the platform-specific | |
| 37 // subclass update the native context menu based on the new model. If NULL is | |
| 38 // passed, subclass should destroy the native context menu. | |
|
sky
2013/07/15 20:41:10
This comment isn't particularly clear. Doesn't the
sidharthms
2013/07/16 01:12:05
Done.
| |
| 39 virtual void UpdatePlatformContextMenu(ui::MenuModel* model) = 0; | |
| 40 | |
| 41 Delegate* delegate() { return delegate_; } | |
| 42 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | |
| 43 | |
| 44 private: | |
| 45 Delegate* delegate_; | |
|
sky
2013/07/15 20:41:10
Constructor needs to initialize this to NULL.
sidharthms
2013/07/16 01:12:05
Done.
| |
| 46 }; | |
| 47 | |
| 48 #endif // UI_LINUX_UI_STATUS_ICON_LINUX_H_ | |
| OLD | NEW |