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