| 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_SHELF_SHELF_WIDGET_H_ | 5 #ifndef ASH_SHELF_SHELF_WIDGET_H_ |
| 6 #define ASH_SHELF_SHELF_WIDGET_H_ | 6 #define ASH_SHELF_SHELF_WIDGET_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/common/shelf/shelf_background_animator.h" | 11 #include "ash/common/shelf/shelf_background_animator.h" |
| 12 #include "ash/common/shelf/shelf_background_animator_observer.h" | 12 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 13 #include "ash/common/shelf/shelf_types.h" | 13 #include "ash/common/shelf/shelf_types.h" |
| 14 #include "ash/shelf/shelf_layout_manager_observer.h" | 14 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 class FocusCycler; | 20 class FocusCycler; |
| 21 class Shelf; | 21 class Shelf; |
| 22 class ShelfLayoutManager; | 22 class ShelfLayoutManager; |
| 23 class ShelfView; |
| 23 class StatusAreaWidget; | 24 class StatusAreaWidget; |
| 24 class WmShelfAura; | 25 class WmShelfAura; |
| 25 class WmWindow; | 26 class WmWindow; |
| 26 | 27 |
| 27 class ASH_EXPORT ShelfWidget : public views::Widget, | 28 class ASH_EXPORT ShelfWidget : public views::Widget, |
| 28 public views::WidgetObserver, | 29 public views::WidgetObserver, |
| 29 public ShelfBackgroundAnimatorObserver, | 30 public ShelfBackgroundAnimatorObserver, |
| 30 public ShelfLayoutManagerObserver { | 31 public ShelfLayoutManagerObserver { |
| 31 public: | 32 public: |
| 32 ShelfWidget(WmWindow* shelf_container, | 33 ShelfWidget(WmWindow* shelf_container, |
| 33 WmWindow* status_container, | 34 WmWindow* status_container, |
| 34 WmShelfAura* wm_shelf_aura); | 35 WmShelfAura* wm_shelf_aura); |
| 35 ~ShelfWidget() override; | 36 ~ShelfWidget() override; |
| 36 | 37 |
| 37 // Returns if shelf alignment option is enabled, and the user is able to | 38 // Returns if shelf alignment option is enabled, and the user is able to |
| 38 // adjust the alignment (guest and supervised mode users cannot for example). | 39 // adjust the alignment (guest and supervised mode users cannot for example). |
| 39 static bool ShelfAlignmentAllowed(); | 40 static bool ShelfAlignmentAllowed(); |
| 40 | 41 |
| 41 void OnShelfAlignmentChanged(); | 42 void OnShelfAlignmentChanged(); |
| 43 |
| 44 // DEPRECATED: Prefer WmShelf::GetAlignment(). |
| 42 ShelfAlignment GetAlignment() const; | 45 ShelfAlignment GetAlignment() const; |
| 43 | 46 |
| 44 // Sets the shelf's background type. | 47 // Sets the shelf's background type. |
| 45 void SetPaintsBackground(ShelfBackgroundType background_type, | 48 void SetPaintsBackground(ShelfBackgroundType background_type, |
| 46 BackgroundAnimatorChangeType change_type); | 49 BackgroundAnimatorChangeType change_type); |
| 47 ShelfBackgroundType GetBackgroundType() const; | 50 ShelfBackgroundType GetBackgroundType() const; |
| 48 | 51 |
| 49 // Hide the shelf behind a black bar during e.g. a user transition when |hide| | 52 // Hide the shelf behind a black bar during e.g. a user transition when |hide| |
| 50 // is true. The |animation_time_ms| will be used as animation duration. | 53 // is true. The |animation_time_ms| will be used as animation duration. |
| 51 void HideShelfBehindBlackBar(bool hide, int animation_time_ms); | 54 void HideShelfBehindBlackBar(bool hide, int animation_time_ms); |
| 52 bool IsShelfHiddenBehindBlackBar() const; | 55 bool IsShelfHiddenBehindBlackBar() const; |
| 53 | 56 |
| 54 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). | 57 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). |
| 55 void SetDimsShelf(bool dimming); | 58 void SetDimsShelf(bool dimming); |
| 56 bool GetDimsShelf() const; | 59 bool GetDimsShelf() const; |
| 57 | 60 |
| 61 // TODO(jamescook): Eliminate these. |
| 62 Shelf* shelf() { return shelf_; } |
| 63 void set_shelf(Shelf* shelf) { shelf_ = shelf; } |
| 64 |
| 58 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } | 65 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } |
| 59 Shelf* shelf() const { return shelf_.get(); } | |
| 60 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } | 66 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } |
| 61 | 67 |
| 62 void CreateShelf(); | 68 ShelfView* CreateShelfView(); |
| 63 void PostCreateShelf(); | 69 void PostCreateShelf(); |
| 64 | 70 |
| 65 // Set visibility of the shelf. | 71 // Set visibility of the shelf. |
| 66 void SetShelfVisibility(bool visible); | 72 void SetShelfVisibility(bool visible); |
| 67 bool IsShelfVisible() const; | 73 bool IsShelfVisible() const; |
| 68 | 74 |
| 69 // Sets the focus cycler. Also adds the shelf to the cycle. | 75 // Sets the focus cycler. Also adds the shelf to the cycle. |
| 70 void SetFocusCycler(FocusCycler* focus_cycler); | 76 void SetFocusCycler(FocusCycler* focus_cycler); |
| 71 FocusCycler* GetFocusCycler(); | 77 FocusCycler* GetFocusCycler(); |
| 72 | 78 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 101 void WillDeleteShelfLayoutManager() override; | 107 void WillDeleteShelfLayoutManager() override; |
| 102 | 108 |
| 103 private: | 109 private: |
| 104 class DelegateView; | 110 class DelegateView; |
| 105 friend class DelegateView; | 111 friend class DelegateView; |
| 106 | 112 |
| 107 WmShelfAura* wm_shelf_aura_; | 113 WmShelfAura* wm_shelf_aura_; |
| 108 | 114 |
| 109 // Owned by the shelf container's aura::Window. | 115 // Owned by the shelf container's aura::Window. |
| 110 ShelfLayoutManager* shelf_layout_manager_; | 116 ShelfLayoutManager* shelf_layout_manager_; |
| 111 std::unique_ptr<Shelf> shelf_; | 117 // Owned by the root window controller. |
| 118 Shelf* shelf_; |
| 112 StatusAreaWidget* status_area_widget_; | 119 StatusAreaWidget* status_area_widget_; |
| 113 | 120 |
| 114 // |delegate_view_| is the contents view of this widget and is cleaned up | 121 // |delegate_view_| is the contents view of this widget and is cleaned up |
| 115 // during CloseChildWindows of the associated RootWindowController. | 122 // during CloseChildWindows of the associated RootWindowController. |
| 116 DelegateView* delegate_view_; | 123 DelegateView* delegate_view_; |
| 124 // View containing the shelf items. Owned by the views hierarchy. |
| 125 ShelfView* shelf_view_; |
| 117 ShelfBackgroundAnimator background_animator_; | 126 ShelfBackgroundAnimator background_animator_; |
| 118 bool activating_as_fallback_; | 127 bool activating_as_fallback_; |
| 119 | 128 |
| 120 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); | 129 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); |
| 121 }; | 130 }; |
| 122 | 131 |
| 123 } // namespace ash | 132 } // namespace ash |
| 124 | 133 |
| 125 #endif // ASH_SHELF_SHELF_WIDGET_H_ | 134 #endif // ASH_SHELF_SHELF_WIDGET_H_ |
| OLD | NEW |