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

Side by Side Diff: ash/wm/screen_pinning_controller.h

Issue 2904073002: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (removes unneeded header) Created 3 years, 7 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
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_state.cc ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_WM_SCREEN_PINNING_CONTROLLER_H_ 5 #ifndef ASH_WM_SCREEN_PINNING_CONTROLLER_H_
6 #define ASH_WM_SCREEN_PINNING_CONTROLLER_H_ 6 #define ASH_WM_SCREEN_PINNING_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/wm_display_observer.h" 12 #include "ash/wm_display_observer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 14
15 namespace aura { 15 namespace aura {
16 class Window; 16 class Window;
17 } 17 }
18 18
19 namespace ash { 19 namespace ash {
20 20
21 class WindowDimmer; 21 class WindowDimmer;
22 class WmWindow;
23 22
24 template <typename UserData> 23 template <typename UserData>
25 class WindowUserData; 24 class WindowUserData;
26 25
27 // Supports "screen pinning" for ARC++ apps. From the Android docs: 26 // Supports "screen pinning" for ARC++ apps. From the Android docs:
28 // "Lets you temporarily restrict users from leaving your task or being 27 // "Lets you temporarily restrict users from leaving your task or being
29 // interrupted by notifications. This could be used, for example, if you are 28 // interrupted by notifications. This could be used, for example, if you are
30 // developing an education app to support high stakes assessment requirements on 29 // developing an education app to support high stakes assessment requirements on
31 // Android, or a single-purpose or kiosk application." 30 // Android, or a single-purpose or kiosk application."
32 // https://developer.android.com/about/versions/android-5.0.html#ScreenPinning 31 // https://developer.android.com/about/versions/android-5.0.html#ScreenPinning
33 // See also ArcKioskAppLauncher::CheckAndPinWindow(). 32 // See also ArcKioskAppLauncher::CheckAndPinWindow().
34 class ASH_EXPORT ScreenPinningController : public WmDisplayObserver { 33 class ASH_EXPORT ScreenPinningController : public WmDisplayObserver {
35 public: 34 public:
36 ScreenPinningController(); 35 ScreenPinningController();
37 ~ScreenPinningController() override; 36 ~ScreenPinningController() override;
38 37
39 // Sets a pinned window. It is not allowed to call this when there already 38 // Sets a pinned window. It is not allowed to call this when there already
40 // is a pinned window. 39 // is a pinned window.
41 void SetPinnedWindow(WmWindow* pinned_window); 40 void SetPinnedWindow(aura::Window* pinned_window);
42 41
43 // Returns true if in pinned mode, otherwise false. 42 // Returns true if in pinned mode, otherwise false.
44 bool IsPinned() const; 43 bool IsPinned() const;
45 44
46 // Returns the pinned window if in pinned mode, or nullptr. 45 // Returns the pinned window if in pinned mode, or nullptr.
47 WmWindow* pinned_window() const { return pinned_window_; } 46 aura::Window* pinned_window() const { return pinned_window_; }
48 47
49 // Called when a new window is added to the container which has the pinned 48 // Called when a new window is added to the container which has the pinned
50 // window. 49 // window.
51 void OnWindowAddedToPinnedContainer(WmWindow* new_window); 50 void OnWindowAddedToPinnedContainer(aura::Window* new_window);
52 51
53 // Called when a window will be removed from the container which has the 52 // Called when a window will be removed from the container which has the
54 // pinned window. 53 // pinned window.
55 void OnWillRemoveWindowFromPinnedContainer(WmWindow* window); 54 void OnWillRemoveWindowFromPinnedContainer(aura::Window* window);
56 55
57 // Called when a window stacking is changed in the container which has the 56 // Called when a window stacking is changed in the container which has the
58 // pinned window. 57 // pinned window.
59 void OnPinnedContainerWindowStackingChanged(WmWindow* window); 58 void OnPinnedContainerWindowStackingChanged(aura::Window* window);
60 59
61 // Called when a new window is added to a system modal container. 60 // Called when a new window is added to a system modal container.
62 void OnWindowAddedToSystemModalContainer(WmWindow* new_window); 61 void OnWindowAddedToSystemModalContainer(aura::Window* new_window);
63 62
64 // Called when a window will be removed from a system modal container. 63 // Called when a window will be removed from a system modal container.
65 void OnWillRemoveWindowFromSystemModalContainer(WmWindow* window); 64 void OnWillRemoveWindowFromSystemModalContainer(aura::Window* window);
66 65
67 // Called when a window stacking is changed in a system modal container. 66 // Called when a window stacking is changed in a system modal container.
68 void OnSystemModalContainerWindowStackingChanged(WmWindow* window); 67 void OnSystemModalContainerWindowStackingChanged(aura::Window* window);
69 68
70 private: 69 private:
71 class PinnedContainerWindowObserver; 70 class PinnedContainerWindowObserver;
72 class PinnedContainerChildWindowObserver; 71 class PinnedContainerChildWindowObserver;
73 class SystemModalContainerWindowObserver; 72 class SystemModalContainerWindowObserver;
74 class SystemModalContainerChildWindowObserver; 73 class SystemModalContainerChildWindowObserver;
75 74
76 // Keeps the pinned window on top of the siblings. 75 // Keeps the pinned window on top of the siblings.
77 void KeepPinnedWindowOnTop(); 76 void KeepPinnedWindowOnTop();
78 77
79 // Keeps the dim window at bottom of the container. 78 // Keeps the dim window at bottom of the container.
80 void KeepDimWindowAtBottom(aura::Window* container); 79 void KeepDimWindowAtBottom(aura::Window* container);
81 80
82 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. 81 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|.
83 // Returns the window from WindowDimmer. 82 // Returns the window from WindowDimmer.
84 WmWindow* CreateWindowDimmer(WmWindow* container); 83 aura::Window* CreateWindowDimmer(aura::Window* container);
85 84
86 // WmDisplayObserver: 85 // WmDisplayObserver:
87 void OnDisplayConfigurationChanged() override; 86 void OnDisplayConfigurationChanged() override;
88 87
89 // Pinned window should be on top in the parent window. 88 // Pinned window should be on top in the parent window.
90 WmWindow* pinned_window_ = nullptr; 89 aura::Window* pinned_window_ = nullptr;
91 90
92 // Owns the WindowDimmers. There is one WindowDimmer for the parent of 91 // Owns the WindowDimmers. There is one WindowDimmer for the parent of
93 // |pinned_window_| and one for each display other than the display 92 // |pinned_window_| and one for each display other than the display
94 // |pinned_window_| is on. 93 // |pinned_window_| is on.
95 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_; 94 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_;
96 95
97 // Set true only when restacking done by this controller. 96 // Set true only when restacking done by this controller.
98 bool in_restacking_ = false; 97 bool in_restacking_ = false;
99 98
100 // Window observers to translate events for the window to this controller. 99 // Window observers to translate events for the window to this controller.
101 std::unique_ptr<PinnedContainerWindowObserver> 100 std::unique_ptr<PinnedContainerWindowObserver>
102 pinned_container_window_observer_; 101 pinned_container_window_observer_;
103 std::unique_ptr<PinnedContainerChildWindowObserver> 102 std::unique_ptr<PinnedContainerChildWindowObserver>
104 pinned_container_child_window_observer_; 103 pinned_container_child_window_observer_;
105 std::unique_ptr<SystemModalContainerWindowObserver> 104 std::unique_ptr<SystemModalContainerWindowObserver>
106 system_modal_container_window_observer_; 105 system_modal_container_window_observer_;
107 std::unique_ptr<SystemModalContainerChildWindowObserver> 106 std::unique_ptr<SystemModalContainerChildWindowObserver>
108 system_modal_container_child_window_observer_; 107 system_modal_container_child_window_observer_;
109 108
110 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); 109 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController);
111 }; 110 };
112 111
113 } // namespace ash 112 } // namespace ash
114 113
115 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ 114 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_window_state.cc ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698