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

Side by Side Diff: ash/shelf/shelf_widget.h

Issue 2015043002: mash: Convert shelf to wm::WmWindow types, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unused include Created 4 years, 6 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
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/shelf/shelf_layout_manager_observer.h" 11 #include "ash/shelf/shelf_layout_manager_observer.h"
12 #include "ash/shelf/shelf_types.h" 12 #include "ash/shelf/shelf_types.h"
13 #include "ash/wm/common/background_animator.h" 13 #include "ash/wm/common/background_animator.h"
14 #include "base/macros.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 #include "ui/views/widget/widget_observer.h" 16 #include "ui/views/widget/widget_observer.h"
16 17
17 namespace aura {
18 class Window;
19 }
20
21 namespace ash { 18 namespace ash {
22 class FocusCycler; 19 class FocusCycler;
23 class Shelf; 20 class Shelf;
24 class ShelfLayoutManager; 21 class ShelfLayoutManager;
25 class StatusAreaWidget; 22 class StatusAreaWidget;
26 class WorkspaceController; 23 class WorkspaceController;
24 namespace wm {
25 class WmWindow;
26 }
27 27
28 class ASH_EXPORT ShelfWidget : public views::Widget, 28 class ASH_EXPORT ShelfWidget : public views::Widget,
29 public views::WidgetObserver, 29 public views::WidgetObserver,
30 public ShelfLayoutManagerObserver { 30 public ShelfLayoutManagerObserver {
31 public: 31 public:
32 ShelfWidget(aura::Window* shelf_container, 32 ShelfWidget(wm::WmWindow* wm_shelf_container,
33 aura::Window* status_container, 33 wm::WmWindow* wm_status_container,
34 WorkspaceController* workspace_controller); 34 WorkspaceController* workspace_controller);
35 ~ShelfWidget() override; 35 ~ShelfWidget() override;
36 36
37 // Returns if shelf alignment option is enabled, and the user is able to 37 // 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). 38 // adjust the alignment (guest and supervised mode users cannot for example).
39 static bool ShelfAlignmentAllowed(); 39 static bool ShelfAlignmentAllowed();
40 40
41 void OnShelfAlignmentChanged(); 41 void OnShelfAlignmentChanged();
42 wm::ShelfAlignment GetAlignment() const; 42 wm::ShelfAlignment GetAlignment() const;
43 43
44 // Sets the shelf's background type. 44 // Sets the shelf's background type.
45 void SetPaintsBackground(wm::ShelfBackgroundType background_type, 45 void SetPaintsBackground(wm::ShelfBackgroundType background_type,
46 BackgroundAnimatorChangeType change_type); 46 BackgroundAnimatorChangeType change_type);
47 wm::ShelfBackgroundType GetBackgroundType() const; 47 wm::ShelfBackgroundType GetBackgroundType() const;
48 48
49 // Hide the shelf behind a black bar during e.g. a user transition when |hide| 49 // 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. 50 // is true. The |animation_time_ms| will be used as animation duration.
51 void HideShelfBehindBlackBar(bool hide, int animation_time_ms); 51 void HideShelfBehindBlackBar(bool hide, int animation_time_ms);
52 bool IsShelfHiddenBehindBlackBar() const; 52 bool IsShelfHiddenBehindBlackBar() const;
53 53
54 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized). 54 // Causes shelf items to be slightly dimmed (e.g. when a window is maximized).
55 void SetDimsShelf(bool dimming); 55 void SetDimsShelf(bool dimming);
56 bool GetDimsShelf() const; 56 bool GetDimsShelf() const;
57 57
58 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } 58 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; }
59 Shelf* shelf() const { return shelf_.get(); } 59 Shelf* shelf() const { return shelf_.get(); }
60 StatusAreaWidget* status_area_widget() const { return status_area_widget_; } 60 StatusAreaWidget* status_area_widget() const { return status_area_widget_; }
61 61
62 void CreateShelf(); 62 void CreateShelf();
63 void PostCreateShelf();
63 64
64 // Set visibility of the shelf. 65 // Set visibility of the shelf.
65 void SetShelfVisibility(bool visible); 66 void SetShelfVisibility(bool visible);
66 bool IsShelfVisible() const; 67 bool IsShelfVisible() const;
67 68
68 // Sets the focus cycler. Also adds the shelf to the cycle. 69 // Sets the focus cycler. Also adds the shelf to the cycle.
69 void SetFocusCycler(FocusCycler* focus_cycler); 70 void SetFocusCycler(FocusCycler* focus_cycler);
70 FocusCycler* GetFocusCycler(); 71 FocusCycler* GetFocusCycler();
71 72
72 // Called by the activation delegate, before the shelf is activated 73 // Called by the activation delegate, before the shelf is activated
73 // when no other windows are visible. 74 // when no other windows are visible.
74 void WillActivateAsFallback() { activating_as_fallback_ = true; } 75 void WillActivateAsFallback() { activating_as_fallback_ = true; }
75 76
76 aura::Window* window_container() { return window_container_; }
77
78 // Clean up prior to deletion. 77 // Clean up prior to deletion.
79 void Shutdown(); 78 void Shutdown();
80 79
81 // Force the shelf to be presented in an undimmed state. 80 // Force the shelf to be presented in an undimmed state.
82 void ForceUndimming(bool force); 81 void ForceUndimming(bool force);
83 82
84 // Overridden from views::WidgetObserver: 83 // Overridden from views::WidgetObserver:
85 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; 84 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
86 85
87 // A function to test the current alpha used by the dimming bar. If there is 86 // A function to test the current alpha used by the dimming bar. If there is
(...skipping 15 matching lines...) Expand all
103 102
104 // views::Widget: 103 // views::Widget:
105 void OnMouseEvent(ui::MouseEvent* event) override; 104 void OnMouseEvent(ui::MouseEvent* event) override;
106 void OnGestureEvent(ui::GestureEvent* event) override; 105 void OnGestureEvent(ui::GestureEvent* event) override;
107 106
108 // Owned by the shelf container's aura::Window. 107 // Owned by the shelf container's aura::Window.
109 ShelfLayoutManager* shelf_layout_manager_; 108 ShelfLayoutManager* shelf_layout_manager_;
110 std::unique_ptr<Shelf> shelf_; 109 std::unique_ptr<Shelf> shelf_;
111 StatusAreaWidget* status_area_widget_; 110 StatusAreaWidget* status_area_widget_;
112 111
113 // delegate_view_ is attached to window_container_ and is cleaned up 112 // |delegate_view_| is the contents view of this widget and is cleaned up
114 // during CloseChildWindows of the associated RootWindowController. 113 // during CloseChildWindows of the associated RootWindowController.
115 DelegateView* delegate_view_; 114 DelegateView* delegate_view_;
116 BackgroundAnimator background_animator_; 115 BackgroundAnimator background_animator_;
117 bool activating_as_fallback_; 116 bool activating_as_fallback_;
118 aura::Window* window_container_; 117
118 DISALLOW_COPY_AND_ASSIGN(ShelfWidget);
119 }; 119 };
120 120
121 } // namespace ash 121 } // namespace ash
122 122
123 #endif // ASH_SHELF_SHELF_WIDGET_H_ 123 #endif // ASH_SHELF_SHELF_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698