Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "ash/ash_export.h" | |
| 11 #include "ash/common/session/session_state_observer.h" | |
| 12 #include "ash/common/shell_observer.h" | |
| 13 #include "ash/common/system/tray/tray_background_view.h" | |
| 14 #include "base/macros.h" | |
| 15 | |
| 16 namespace views { | |
| 17 class ImageView; | |
| 18 class Widget; | |
| 19 } | |
| 20 | |
| 21 namespace ash { | |
| 22 | |
| 23 class TrayBubbleWrapper; | |
| 24 class PaletteToolManager; | |
| 25 | |
| 26 class ASH_EXPORT PaletteTray : public TrayBackgroundView, | |
| 27 public SessionStateObserver, | |
| 28 public ShellObserver, | |
| 29 public views::TrayBubbleView::Delegate { | |
| 30 public: | |
| 31 explicit PaletteTray(WmShelf* wm_shelf); | |
| 32 ~PaletteTray() override; | |
| 33 | |
| 34 // ActionableView overrides. | |
|
oshima
2016/07/13 21:14:23
nit: // ActionableView:
same for the rest.
jdufault
2016/07/18 20:44:02
Done.
| |
| 35 bool PerformAction(const ui::Event& event) override; | |
| 36 | |
| 37 // SessionStateObserver overrides. | |
| 38 void SessionStateChanged(SessionStateDelegate::SessionState state) override; | |
| 39 | |
| 40 // TrayBackgroundView overrides. | |
| 41 void ClickedOutsideBubble() override; | |
| 42 base::string16 GetAccessibleNameForTray() override; | |
| 43 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override; | |
| 44 void SetShelfAlignment(ShelfAlignment alignment) override; | |
| 45 void AnchorUpdated() override; | |
| 46 | |
| 47 private: | |
| 48 // friend class OverviewButtonTrayTest; | |
|
oshima
2016/07/13 21:14:23
remove this?
jdufault
2016/07/18 20:44:02
Done.
| |
| 49 | |
| 50 // views::TrayBubbleView::Delegate: | |
| 51 void BubbleViewDestroyed() override; | |
| 52 void OnMouseEnteredView() override; | |
| 53 void OnMouseExitedView() override; | |
| 54 base::string16 GetAccessibleNameForBubble() override; | |
| 55 gfx::Rect GetAnchorRect(views::Widget* anchor_widget, | |
| 56 AnchorType anchor_type, | |
| 57 AnchorAlignment anchor_alignment) const override; | |
| 58 void OnBeforeBubbleWidgetInit( | |
| 59 views::Widget* anchor_widget, | |
| 60 views::Widget* bubble_widget, | |
| 61 views::Widget::InitParams* params) const override; | |
| 62 void HideBubble(const views::TrayBubbleView* bubble_view) override; | |
| 63 | |
| 64 // Creates a new border for the icon. The padding is determined based on the | |
| 65 // alignment of the shelf. | |
| 66 void SetIconBorderForShelfAlignment(); | |
| 67 | |
| 68 // Updates the tray icon from the palette tool manager. | |
| 69 void UpdateTrayIcon(); | |
| 70 | |
| 71 // Sets the icon to visible if the palette can be used. | |
| 72 void UpdateIconVisibility(); | |
| 73 | |
| 74 bool OpenBubble(); | |
| 75 void AddToolsToView(views::View* host); | |
| 76 | |
| 77 std::unique_ptr<PaletteToolManager> palette_tool_manager_; | |
| 78 std::unique_ptr<TrayBubbleWrapper> bubble_; | |
|
oshima
2016/07/13 21:14:23
#include <memory>
jdufault
2016/07/18 20:44:02
Done.
| |
| 79 | |
| 80 // Weak pointer, will be parented by TrayContainer for its lifetime. | |
| 81 views::ImageView* icon_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(PaletteTray); | |
| 84 }; | |
| 85 | |
| 86 } // namespace ash | |
| 87 | |
| 88 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_ | |
| OLD | NEW |