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

Unified 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: address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/overview/window_selector_controller.cc ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/screen_pinning_controller.h
diff --git a/ash/wm/screen_pinning_controller.h b/ash/wm/screen_pinning_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e0b42d861259b816a144ad0cf54f5e076667575
--- /dev/null
+++ b/ash/wm/screen_pinning_controller.h
@@ -0,0 +1,114 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_SCREEN_PINNING_CONTROLLER_H_
+#define ASH_WM_SCREEN_PINNING_CONTROLLER_H_
+
+#include <memory>
+#include <vector>
+
+#include "ash/display/window_tree_host_manager.h"
+#include "base/macros.h"
+
+namespace ash {
+
+class WindowTreeHostManager;
+class WmShellCommon;
+class WmWindow;
+
+// Handles pinned state.
+class ScreenPinningController : public WindowTreeHostManager::Observer {
+ public:
+ ScreenPinningController(WmShellCommon* wm_shell_common,
+ WindowTreeHostManager* window_tree_host_manager);
+ ~ScreenPinningController() override;
+
+ // Sets a pinned window. It is not allowed to call this when there already
+ // is a pinned window.
+ void SetPinnedWindow(WmWindow* pinned_window);
+
+ // Returns true if in pinned mode, otherwise false.
+ bool IsPinned() const;
+
+ // Called when a new window is added to the container which has the pinned
+ // window.
+ void OnWindowAddedToPinnedContainer(WmWindow* new_window);
+
+ // Called when a window will be removed from the container which has the
+ // pinned window.
+ void OnWillRemoveWindowFromPinnedContainer(WmWindow* window);
+
+ // Called when a window stacking is changed in the container which has the
+ // pinned window.
+ void OnPinnedContainerWindowStackingChanged(WmWindow* window);
+
+ // Called when a new window is added to a system modal container.
+ void OnWindowAddedToSystemModalContainer(WmWindow* new_window);
+
+ // Called when a window will be removed from a system modal container.
+ void OnWillRemoveWindowFromSystemModalContainer(WmWindow* window);
+
+ // Called when a window stacking is changed in a system modal container.
+ void OnSystemModalContainerWindowStackingChanged(WmWindow* window);
+
+ // Called when a dim window in the system modal container is destroying.
+ void OnDimWindowDestroying(WmWindow* window);
+
+ private:
+ class PinnedContainerWindowObserver;
+ class PinnedContainerChildWindowObserver;
+ class SystemModalContainerWindowObserver;
+ class SystemModalContainerChildWindowObserver;
+ class DimWindowObserver;
+
+ // Keeps the pinned window on top of the siblings.
+ void KeepPinnedWindowOnTop();
+
+ // Keeps the dim window at bottom of the container.
+ void KeepDimWindowAtBottom(WmWindow* container);
+
+ // WindowTreeHostManager::Observer:
+ void OnDisplayConfigurationChanged() override;
+
+ // Pinned window should be on top in the parent window.
+ WmWindow* pinned_window_ = nullptr;
+
+ // Dim background window just behind of the pinned window.
+ // Not owned. The parent has its ownership.
+ WmWindow* background_window_ = nullptr;
+
+ // In pinned mode, all displays other than the one where pinned_window_ is.
+ // Similar to background_window_, not owned.
+ std::vector<WmWindow*> dim_windows_;
+
+ // Set true only when restacking done by this controller.
+ bool in_restacking_ = false;
+
+ // For OnPinnedStateChanged event notification.
+ // While this controller is alive, it needs to be ensured that the instances
+ // refered from the pointers should be alive.
+ WmShellCommon* wm_shell_common_;
+
+ // Keep references to remove this as a observer.
+ // While this controller is alive, it needs to be ensured that the instances
+ // refered from the pointers should be alive.
+ WindowTreeHostManager* window_tree_host_manager_;
+
+ // Window observers to translate events for the window to this controller.
+ std::unique_ptr<PinnedContainerWindowObserver>
+ pinned_container_window_observer_;
+ std::unique_ptr<PinnedContainerChildWindowObserver>
+ pinned_container_child_window_observer_;
+ std::unique_ptr<SystemModalContainerWindowObserver>
+ system_modal_container_window_observer_;
+ std::unique_ptr<SystemModalContainerChildWindowObserver>
+ system_modal_container_child_window_observer_;
+ std::unique_ptr<DimWindowObserver> dim_window_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScreenPinningController);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_SCREEN_PINNING_CONTROLLER_H_
« no previous file with comments | « ash/wm/overview/window_selector_controller.cc ('k') | ash/wm/screen_pinning_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698