| 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/shelf/shelf_types.h" | 9 #include "ash/common/shelf/shelf_types.h" |
| 10 #include "ash/wm/gestures/shelf_gesture_handler.h" | 10 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
| 13 #include "ui/views/accessible_pane_view.h" | 13 #include "ui/views/accessible_pane_view.h" |
| 14 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 class FocusCycler; | 17 class FocusCycler; |
| 18 | 18 |
| 19 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, | 19 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, |
| 20 public views::WidgetDelegate { | 20 public views::WidgetDelegate { |
| 21 public: | 21 public: |
| 22 StatusAreaWidgetDelegate(); | 22 StatusAreaWidgetDelegate(); |
| 23 ~StatusAreaWidgetDelegate() override; | 23 ~StatusAreaWidgetDelegate() override; |
| 24 | 24 |
| 25 // Add a tray view to the widget (e.g. system tray, web notifications). | 25 // Add a tray view to the widget (e.g. system tray, web notifications). |
| 26 void AddTray(views::View* tray); | 26 void AddTray(views::View* tray); |
| 27 | 27 |
| 28 // Called whenever layout might change (e.g. alignment changed). | 28 // Called whenever layout might change (e.g. alignment changed). |
| 29 void UpdateLayout(); | 29 void UpdateLayout(); |
| 30 | 30 |
| 31 // Sets the focus cycler. | 31 // Sets the focus cycler. |
| 32 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); | 32 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); |
| 33 | 33 |
| 34 void set_alignment(wm::ShelfAlignment alignment) { alignment_ = alignment; } | 34 void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; } |
| 35 | 35 |
| 36 // Overridden from views::AccessiblePaneView. | 36 // Overridden from views::AccessiblePaneView. |
| 37 View* GetDefaultFocusableChild() override; | 37 View* GetDefaultFocusableChild() override; |
| 38 | 38 |
| 39 // Overridden from views::View: | 39 // Overridden from views::View: |
| 40 views::Widget* GetWidget() override; | 40 views::Widget* GetWidget() override; |
| 41 const views::Widget* GetWidget() const override; | 41 const views::Widget* GetWidget() const override; |
| 42 | 42 |
| 43 // Overridden from ui::EventHandler: | 43 // Overridden from ui::EventHandler: |
| 44 void OnGestureEvent(ui::GestureEvent* event) override; | 44 void OnGestureEvent(ui::GestureEvent* event) override; |
| 45 | 45 |
| 46 // views::WidgetDelegate overrides: | 46 // views::WidgetDelegate overrides: |
| 47 bool CanActivate() const override; | 47 bool CanActivate() const override; |
| 48 void DeleteDelegate() override; | 48 void DeleteDelegate() override; |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 // Overridden from views::View: | 51 // Overridden from views::View: |
| 52 void ChildPreferredSizeChanged(views::View* child) override; | 52 void ChildPreferredSizeChanged(views::View* child) override; |
| 53 void ChildVisibilityChanged(views::View* child) override; | 53 void ChildVisibilityChanged(views::View* child) override; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 void UpdateWidgetSize(); | 56 void UpdateWidgetSize(); |
| 57 | 57 |
| 58 const FocusCycler* focus_cycler_for_testing_; | 58 const FocusCycler* focus_cycler_for_testing_; |
| 59 wm::ShelfAlignment alignment_; | 59 ShelfAlignment alignment_; |
| 60 | 60 |
| 61 ShelfGestureHandler gesture_handler_; | 61 ShelfGestureHandler gesture_handler_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); | 63 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace ash | 66 } // namespace ash |
| 67 | 67 |
| 68 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ | 68 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ |
| OLD | NEW |