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

Unified Diff: ash/common/wm/lock_layout_manager.cc

Issue 2354533004: Ports LockLayoutManager/LockWindowState to ash/common (Closed)
Patch Set: Created 4 years, 3 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
Index: ash/common/wm/lock_layout_manager.cc
diff --git a/ash/wm/lock_layout_manager.cc b/ash/common/wm/lock_layout_manager.cc
similarity index 65%
rename from ash/wm/lock_layout_manager.cc
rename to ash/common/wm/lock_layout_manager.cc
index 88de7fd057e16beda64d72a73ef636ed25abe43f..ebabf3fa922c11ce4dadc780d3a376e9ccf6dcb0 100644
--- a/ash/wm/lock_layout_manager.cc
+++ b/ash/common/wm/lock_layout_manager.cc
@@ -2,23 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/lock_layout_manager.h"
+#include "ash/common/wm/lock_layout_manager.h"
+#include "ash/common/wm/lock_window_state.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm/wm_event.h"
#include "ash/common/wm_shell.h"
-#include "ash/wm/lock_window_state.h"
-#include "ash/wm/window_state_aura.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
+#include "ash/common/wm_window.h"
#include "ui/events/event.h"
#include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_util.h"
namespace ash {
-LockLayoutManager::LockLayoutManager(aura::Window* window)
- : SnapToPixelLayoutManager(window),
+LockLayoutManager::LockLayoutManager(WmWindow* window)
+ : wm::WmSnapToPixelLayoutManager(),
window_(window),
root_window_(window->GetRootWindow()),
is_observing_keyboard_(false) {
@@ -34,10 +32,8 @@ LockLayoutManager::~LockLayoutManager() {
if (root_window_)
root_window_->RemoveObserver(this);
- for (aura::Window::Windows::const_iterator it = window_->children().begin();
- it != window_->children().end(); ++it) {
- (*it)->RemoveObserver(this);
- }
+ for (WmWindow* child : window_->GetChildren())
+ child->RemoveObserver(this);
WmShell::Get()->RemoveShellObserver(this);
@@ -52,7 +48,7 @@ void LockLayoutManager::OnWindowResized() {
AdjustWindowsForWorkAreaChange(&event);
}
-void LockLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
+void LockLayoutManager::OnWindowAddedToLayout(WmWindow* child) {
child->AddObserver(this);
// LockWindowState replaces default WindowState of a child.
@@ -61,38 +57,29 @@ void LockLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
window_state->OnWMEvent(&event);
}
-void LockLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
+void LockLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {
child->RemoveObserver(this);
}
-void LockLayoutManager::OnWindowRemovedFromLayout(aura::Window* child) {}
+void LockLayoutManager::OnWindowRemovedFromLayout(WmWindow* child) {}
-void LockLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
+void LockLayoutManager::OnChildWindowVisibilityChanged(WmWindow* child,
bool visible) {}
-void LockLayoutManager::SetChildBounds(aura::Window* child,
+void LockLayoutManager::SetChildBounds(WmWindow* child,
const gfx::Rect& requested_bounds) {
- wm::WindowState* window_state = wm::GetWindowState(child);
+ wm::WindowState* window_state = child->GetWindowState();
wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds);
window_state->OnWMEvent(&event);
}
-void LockLayoutManager::OnWindowHierarchyChanged(
- const WindowObserver::HierarchyChangeParams& params) {}
-
-void LockLayoutManager::OnWindowPropertyChanged(aura::Window* window,
- const void* key,
- intptr_t old) {}
-
-void LockLayoutManager::OnWindowStackingChanged(aura::Window* window) {}
-
-void LockLayoutManager::OnWindowDestroying(aura::Window* window) {
+void LockLayoutManager::OnWindowDestroying(WmWindow* window) {
window->RemoveObserver(this);
if (root_window_ == window)
- root_window_ = NULL;
+ root_window_ = nullptr;
}
-void LockLayoutManager::OnWindowBoundsChanged(aura::Window* window,
+void LockLayoutManager::OnWindowBoundsChanged(WmWindow* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
if (root_window_ == window) {
@@ -127,10 +114,8 @@ void LockLayoutManager::AdjustWindowsForWorkAreaChange(
DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
- for (aura::Window::Windows::const_iterator it = window_->children().begin();
- it != window_->children().end(); ++it) {
- wm::GetWindowState(*it)->OnWMEvent(event);
- }
+ for (WmWindow* child : window_->GetChildren())
+ child->GetWindowState()->OnWMEvent(event);
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698