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

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

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_SCREEN_PINNING_CONTROLLER_H_
6 #define ASH_WM_SCREEN_PINNING_CONTROLLER_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "ash/common/shell_observer.h"
12 #include "ash/display/window_tree_host_manager.h"
13 #include "base/macros.h"
14
15 namespace aura {
16 class WindowObserver;
17 }
18
19 namespace ash {
20
21 class WindowTreeHostManager;
22 class WmShellCommon;
23 class WmWindow;
24
25 // Handles pinned state.
26 class ScreenPinningController : public ShellObserver,
27 public WindowTreeHostManager::Observer {
28 public:
29 ScreenPinningController(WmShellCommon* wm_shell_common,
30 WindowTreeHostManager* window_tree_host_manager);
31 ~ScreenPinningController() override;
32
33 // Returns true if in pinned mode, otherwise false.
34 bool IsPinned() const;
35
36 // Called when a new window is added to the container which has the pinned
37 // window.
38 void OnWindowAddedToPinnedContainer(WmWindow* new_window);
39
40 // Called when a window will be removed from the container which has the
41 // pinned window.
42 void OnWillRemoveWindowFromPinnedContainer(WmWindow* window);
43
44 // Called when a window stacking is changed in the container which has the
45 // pinned window.
46 void OnPinnedContainerWindowStackingChanged(WmWindow* window);
47
48 // Called when a new window is added to a system modal container.
49 void OnWindowAddedToSystemModalContainer(WmWindow* new_window);
50
51 // Called when a window will be removed from a system modal container.
52 void OnWillRemoveWindowFromSystemModalContainer(WmWindow* window);
53
54 // Called when a window stacking is changed in a system modal container.
55 void OnSystemModalContainerWindowStackingChanged(WmWindow* window);
56
57 // Called when a dim window in the system modal container is destroying.
58 void OnDimWindowDestroying(WmWindow* window);
59
60 private:
61 class PinnedContainerWindowObserver;
62 class PinnedContainerChildWindowObserver;
63 class SystemModalContainerWindowObserver;
64 class SystemModalContainerChildWindowObserver;
65 class DimWindowObserver;
66
67 // Keeps the pinned window on top of the siblings.
68 void KeepPinnedWindowOnTop();
69
70 // Keeps the dim window at bottom of the container.
71 void KeepDimWindowAtBottom(WmWindow* container);
72
73 // ShellObserver:
74 void OnPinnedStateChanged(WmWindow* pinned_window) override;
75
76 // WindowTreeHostManager::Observer:
77 void OnDisplayConfigurationChanged() override;
78
79 // Pinned window should be on top in the parent window.
80 WmWindow* pinned_window_ = nullptr;
81
82 // Dim background window just behind of the pinned window.
83 // Not owned. The parent has its ownership.
84 WmWindow* background_window_ = nullptr;
85
86 // In pinned mode, all displays other than the one where pinned_window_ is.
87 // Similar to background_window_, not owned.
88 std::vector<WmWindow*> dim_windows_;
89
90 // Set true only when restacking done by this controller.
91 bool in_restacking_ = false;
92
93 // Keep references to remove this as a observer.
94 // While this controller is alive, it needs to be ensured that the instances
95 // refered from the pointers should be alive.
96 WmShellCommon* wm_shell_common_;
97 WindowTreeHostManager* window_tree_host_manager_;
98
99 // Window observers to translate events for the window to this controller.
100 std::unique_ptr<PinnedContainerWindowObserver>
101 pinned_container_window_observer_;
102 std::unique_ptr<PinnedContainerChildWindowObserver>
103 pinned_container_child_window_observer_;
104 std::unique_ptr<SystemModalContainerWindowObserver>
105 system_modal_container_window_observer_;
106 std::unique_ptr<SystemModalContainerChildWindowObserver>
107 system_modal_container_child_window_observer_;
108 std::unique_ptr<DimWindowObserver> dim_window_observer_;
109
110 DISALLOW_COPY_AND_ASSIGN(ScreenPinningController);
111 };
112
113 } // namespace ash
114
115 #endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698