| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ | |
| 6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "ash/system/tray/actionable_view.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "ui/views/view.h" | |
| 13 | |
| 14 namespace views { | |
| 15 class ImageView; | |
| 16 class Label; | |
| 17 class View; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 class SystemTrayItem; | |
| 22 class TrayPopupItemStyle; | |
| 23 class TriView; | |
| 24 | |
| 25 // A view with a more arrow on the right edge. Clicking on the view brings up | |
| 26 // the detailed view of the tray-item that owns it. If the view is disabled, it | |
| 27 // will not show the more arrow. | |
| 28 class TrayItemMore : public ActionableView { | |
| 29 public: | |
| 30 explicit TrayItemMore(SystemTrayItem* owner); | |
| 31 ~TrayItemMore() override; | |
| 32 | |
| 33 void SetLabel(const base::string16& label); | |
| 34 void SetImage(const gfx::ImageSkia& image_skia); | |
| 35 void SetAccessibleName(const base::string16& name); | |
| 36 | |
| 37 protected: | |
| 38 // Returns a style that will be applied to the elements in the UpdateStyle() | |
| 39 // method if |this| is enabled; otherwise, we force |this| to use | |
| 40 // ColorStyle::DISABLED. | |
| 41 std::unique_ptr<TrayPopupItemStyle> CreateStyle() const; | |
| 42 | |
| 43 // Called by CreateStyle() to give descendants a chance to customize the | |
| 44 // style; e.g. to change the style's ColorStyle based on whether Bluetooth is | |
| 45 // enabled/disabled. | |
| 46 virtual std::unique_ptr<TrayPopupItemStyle> HandleCreateStyle() const; | |
| 47 | |
| 48 // Applies the style created from CreateStyle(). Should be called whenever any | |
| 49 // input state changes that changes the style configuration created by | |
| 50 // CreateStyle(). E.g. if Bluetooth is changed between enabled/disabled then | |
| 51 // a differently configured style will be returned from CreateStyle() and thus | |
| 52 // it will need to be applied. | |
| 53 virtual void UpdateStyle(); | |
| 54 | |
| 55 private: | |
| 56 // Overridden from ActionableView. | |
| 57 bool PerformAction(const ui::Event& event) override; | |
| 58 | |
| 59 // Overridden from views::View. | |
| 60 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | |
| 61 void OnEnabledChanged() override; | |
| 62 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | |
| 63 | |
| 64 TriView* tri_view_; | |
| 65 views::ImageView* icon_; | |
| 66 views::Label* label_; | |
| 67 views::ImageView* more_; | |
| 68 base::string16 accessible_name_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); | |
| 71 }; | |
| 72 | |
| 73 } // namespace ash | |
| 74 | |
| 75 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ | |
| OLD | NEW |