Index: ash/wm/lock_action_handler_layout_manager.h |
diff --git a/ash/wm/lock_action_handler_layout_manager.h b/ash/wm/lock_action_handler_layout_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d1d41113c96e8eb7dcdd7f73c8ce0e0914910562 |
--- /dev/null |
+++ b/ash/wm/lock_action_handler_layout_manager.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2017 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_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_ |
+#define ASH_WM_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_ |
+ |
+#include "ash/ash_export.h" |
+#include "ash/public/cpp/shelf_types.h" |
+#include "ash/shelf/wm_shelf_observer.h" |
+#include "ash/tray_action/tray_action_observer.h" |
+#include "ash/wm/lock_layout_manager.h" |
+#include "base/macros.h" |
+#include "base/scoped_observer.h" |
+ |
+namespace ash { |
+ |
+class TrayAction; |
+class WmShelf; |
+ |
+// Window layout manager for windows intended to handle lock tray actions. |
+// Since "new note" is currently the only supported action, the layout |
+// manager uses new note tray action state to determine it state. |
+// The layout is intended to be used for two window containers: |
+// * LockActionHandlerContainer - parents handler windows when the new note |
+// action is in active state, i.e. handler windows should be visible on |
+// top of lock screen. |
+// * LockActionHandlerContainer_Background - parents handler windows when the |
+// new note action is in background state, i.e. handler windows should be |
+// visible below the lock screen UI. |
+// The layout manager will observe new note action state changes and reparent |
+// the associated container's children as needed. |
+// The windows in this container will have be maximized, if possible. If they |
+// are not resible, they will be centered on the screen - similar to windows |
+// in lock screen container. |
+// Unlike lock layout manager, when maximizing windows, this layout manager will |
+// ensure that the windows do not obscure the system shelf. |
+class ASH_EXPORT LockActionHandlerLayoutManager : public LockLayoutManager, |
+ public WmShelfObserver, |
+ public TrayActionObserver { |
+ public: |
+ LockActionHandlerLayoutManager(aura::Window* window, WmShelf* wm_shelf); |
+ ~LockActionHandlerLayoutManager() override; |
+ |
+ // WmSnapToPixelLayoutManager: |
+ void OnWindowAddedToLayout(aura::Window* child) override; |
+ void OnChildWindowVisibilityChanged(aura::Window* child, |
+ bool visibile) override; |
+ |
+ // WmShelfObserver: |
+ void WillChangeVisibilityState(ShelfVisibilityState visibility) override; |
+ |
+ // TrayActionObserver: |
+ void OnLockScreenNoteStateChanged(mojom::TrayActionState state) override; |
+ |
+ private: |
+ aura::Window* GetActiveActionHandlerContainer(mojom::TrayActionState state); |
+ |
+ ScopedObserver<WmShelf, WmShelfObserver> shelf_observer_; |
+ ScopedObserver<TrayAction, TrayActionObserver> tray_action_observer_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LockActionHandlerLayoutManager); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_WM_LOCK_ACTION_HANDLER_LAYOUT_MANAGER_H_ |