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

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

Issue 2777103005: Using WmDisplayObserver in ScreenPinningController. (Closed)
Patch Set: Created 3 years, 8 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/shell.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/display/window_tree_host_manager.h" 11 #include "ash/common/wm_display_observer.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 13
14 namespace aura { 14 namespace aura {
15 class Window; 15 class Window;
16 } 16 }
17 17
18 namespace ash { 18 namespace ash {
19 19
20 class WindowDimmer; 20 class WindowDimmer;
21 class WindowTreeHostManager;
22 class WmWindow; 21 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 ScreenPinningController : public WindowTreeHostManager::Observer { 33 class ScreenPinningController : public WmDisplayObserver {
35 public: 34 public:
36 explicit ScreenPinningController( 35 ScreenPinningController();
37 WindowTreeHostManager* window_tree_host_manager);
38 ~ScreenPinningController() override; 36 ~ScreenPinningController() override;
39 37
40 // 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
41 // is a pinned window. 39 // is a pinned window.
42 void SetPinnedWindow(WmWindow* pinned_window); 40 void SetPinnedWindow(WmWindow* pinned_window);
43 41
44 // Returns true if in pinned mode, otherwise false. 42 // Returns true if in pinned mode, otherwise false.
45 bool IsPinned() const; 43 bool IsPinned() const;
46 44
47 // Returns the pinned window if in pinned mode, or nullptr. 45 // Returns the pinned window if in pinned mode, or nullptr.
(...skipping 29 matching lines...) Expand all
77 // Keeps the pinned window on top of the siblings. 75 // Keeps the pinned window on top of the siblings.
78 void KeepPinnedWindowOnTop(); 76 void KeepPinnedWindowOnTop();
79 77
80 // Keeps the dim window at bottom of the container. 78 // Keeps the dim window at bottom of the container.
81 void KeepDimWindowAtBottom(aura::Window* container); 79 void KeepDimWindowAtBottom(aura::Window* container);
82 80
83 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|. 81 // Creates a WindowDimmer for |container| and places it in |window_dimmers_|.
84 // Returns the window from WindowDimmer. 82 // Returns the window from WindowDimmer.
85 WmWindow* CreateWindowDimmer(WmWindow* container); 83 WmWindow* CreateWindowDimmer(WmWindow* container);
86 84
87 // WindowTreeHostManager::Observer: 85 // WmDisplayObserver:
88 void OnDisplayConfigurationChanged() override; 86 void OnDisplayConfigurationChanged() override;
89 87
90 // Pinned window should be on top in the parent window. 88 // Pinned window should be on top in the parent window.
91 WmWindow* pinned_window_ = nullptr; 89 WmWindow* pinned_window_ = nullptr;
92 90
93 // Owns the WindowDimmers. There is one WindowDimmer for the parent of 91 // Owns the WindowDimmers. There is one WindowDimmer for the parent of
94 // |pinned_window_| and one for each display other than the display 92 // |pinned_window_| and one for each display other than the display
95 // |pinned_window_| is on. 93 // |pinned_window_| is on.
96 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_; 94 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_;
97 95
98 // Set true only when restacking done by this controller. 96 // Set true only when restacking done by this controller.
99 bool in_restacking_ = false; 97 bool in_restacking_ = false;
100 98
101 // Keep references to remove this as a observer.
102 // While this controller is alive, it needs to be ensured that the instances
103 // refered from the pointers should be alive.
104 WindowTreeHostManager* window_tree_host_manager_;
105
106 // Window observers to translate events for the window to this controller. 99 // Window observers to translate events for the window to this controller.
107 std::unique_ptr<PinnedContainerWindowObserver> 100 std::unique_ptr<PinnedContainerWindowObserver>
108 pinned_container_window_observer_; 101 pinned_container_window_observer_;
109 std::unique_ptr<PinnedContainerChildWindowObserver> 102 std::unique_ptr<PinnedContainerChildWindowObserver>
110 pinned_container_child_window_observer_; 103 pinned_container_child_window_observer_;
111 std::unique_ptr<SystemModalContainerWindowObserver> 104 std::unique_ptr<SystemModalContainerWindowObserver>
112 system_modal_container_window_observer_; 105 system_modal_container_window_observer_;
113 std::unique_ptr<SystemModalContainerChildWindowObserver> 106 std::unique_ptr<SystemModalContainerChildWindowObserver>
114 system_modal_container_child_window_observer_; 107 system_modal_container_child_window_observer_;
115 108
116 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController); 109 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController);
117 }; 110 };
118 111
119 } // namespace ash 112 } // namespace ash
120 113
121 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_ 114 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698