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

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

Powered by Google App Engine
This is Rietveld 408576698