Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: ash/common/system/chromeos/palette/palette_tray.h

Issue 2148573002: Add palette tray to ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stylus-tool-structure
Patch Set: Nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include <memory>
10
11 #include "ash/ash_export.h"
12 #include "ash/common/session/session_state_observer.h"
13 #include "ash/common/shell_observer.h"
14 #include "ash/common/system/chromeos/palette/palette_tool_manager.h"
15 #include "ash/common/system/tray/tray_background_view.h"
16 #include "base/macros.h"
17
18 namespace views {
19 class ImageView;
20 class Widget;
21 }
22
23 namespace ash {
24
25 class TrayBubbleWrapper;
26 class PaletteToolManager;
27
28 // The PaletteTray shows the palette in the bottom area of the screen. This
29 // class also controls the lifetime for all of the tools available in the
30 // palette.
31 class ASH_EXPORT PaletteTray : public TrayBackgroundView,
32 public SessionStateObserver,
33 public ShellObserver,
34 public PaletteToolManager::Delegate,
35 public views::TrayBubbleView::Delegate {
36 public:
37 explicit PaletteTray(WmShelf* wm_shelf);
38 ~PaletteTray() override;
39
40 // ActionableView:
41 bool PerformAction(const ui::Event& event) override;
42
43 // SessionStateObserver:
44 void SessionStateChanged(SessionStateDelegate::SessionState state) override;
45
46 // TrayBackgroundView:
47 void ClickedOutsideBubble() override;
48 base::string16 GetAccessibleNameForTray() override;
49 void HideBubbleWithView(const views::TrayBubbleView* bubble_view) override;
50 void SetShelfAlignment(ShelfAlignment alignment) override;
51 void AnchorUpdated() override;
52
53 private:
54 // views::TrayBubbleView::Delegate:
55 void BubbleViewDestroyed() override;
56 void OnMouseEnteredView() override;
57 void OnMouseExitedView() override;
58 base::string16 GetAccessibleNameForBubble() override;
59 gfx::Rect GetAnchorRect(views::Widget* anchor_widget,
60 AnchorType anchor_type,
61 AnchorAlignment anchor_alignment) const override;
62 void OnBeforeBubbleWidgetInit(
63 views::Widget* anchor_widget,
64 views::Widget* bubble_widget,
65 views::Widget::InitParams* params) const override;
66 void HideBubble(const views::TrayBubbleView* bubble_view) override;
67
68 // PaletteToolManager::Delegate:
69 void HidePalette() override;
70 void OnActiveToolChanged() override;
71 WmWindow* GetWindow() override;
72
73 // Creates a new border for the icon. The padding is determined based on the
74 // alignment of the shelf.
75 void SetIconBorderForShelfAlignment();
76
77 // Updates the tray icon from the palette tool manager.
78 void UpdateTrayIcon();
79
80 // Sets the icon to visible if the palette can be used.
81 void UpdateIconVisibility();
82
83 bool OpenBubble();
84 void AddToolsToView(views::View* host);
85
86 std::unique_ptr<PaletteToolManager> palette_tool_manager_;
87 std::unique_ptr<TrayBubbleWrapper> bubble_;
88
89 // Weak pointer, will be parented by TrayContainer for its lifetime.
90 views::ImageView* icon_;
91
92 DISALLOW_COPY_AND_ASSIGN(PaletteTray);
93 };
94
95 } // namespace ash
96
97 #endif // ASH_COMMON_SYSTEM_CHROMEOS_PALETTE_PALETTE_BUTTON_TRAY_H_
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/palette/palette_tool_manager.cc ('k') | ash/common/system/chromeos/palette/palette_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698