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_COMMON_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | |
6 #define ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/public/cpp/shelf_types.h" | |
10 #include "base/macros.h" | |
11 #include "ui/gfx/image/image_skia.h" | |
12 #include "ui/views/accessible_pane_view.h" | |
13 #include "ui/views/widget/widget_delegate.h" | |
14 | |
15 namespace ash { | |
16 class FocusCycler; | |
17 | |
18 // The View for the status area widget. | |
19 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, | |
20 public views::WidgetDelegate { | |
21 public: | |
22 StatusAreaWidgetDelegate(); | |
23 ~StatusAreaWidgetDelegate() override; | |
24 | |
25 // Add a tray view to the widget (e.g. system tray, web notifications). | |
26 void AddTray(views::View* tray); | |
27 | |
28 // Called whenever layout might change (e.g. alignment changed). | |
29 void UpdateLayout(); | |
30 | |
31 // Sets the focus cycler. | |
32 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); | |
33 | |
34 void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; } | |
35 | |
36 // Overridden from views::AccessiblePaneView. | |
37 View* GetDefaultFocusableChild() override; | |
38 | |
39 // Overridden from views::View: | |
40 views::Widget* GetWidget() override; | |
41 const views::Widget* GetWidget() const override; | |
42 | |
43 // Overridden from ui::EventHandler: | |
44 void OnGestureEvent(ui::GestureEvent* event) override; | |
45 | |
46 // views::WidgetDelegate overrides: | |
47 bool CanActivate() const override; | |
48 void DeleteDelegate() override; | |
49 | |
50 protected: | |
51 // Overridden from views::View: | |
52 void ChildPreferredSizeChanged(views::View* child) override; | |
53 void ChildVisibilityChanged(views::View* child) override; | |
54 | |
55 private: | |
56 void UpdateWidgetSize(); | |
57 | |
58 // Sets a border on |child|. If |extend_border_to_edge| is true, then an extra | |
59 // wide border is added to extend the view's hit region to the edge of the | |
60 // screen. | |
61 void SetBorderOnChild(views::View* child, bool extend_border_to_edge); | |
62 | |
63 const FocusCycler* focus_cycler_for_testing_; | |
64 | |
65 // TODO(jamescook): Get this from WmShelf. | |
66 ShelfAlignment alignment_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); | |
69 }; | |
70 | |
71 } // namespace ash | |
72 | |
73 #endif // ASH_COMMON_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | |
OLD | NEW |