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

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

Powered by Google App Engine
This is Rietveld 408576698