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

Unified Diff: ash/common/wm/workspace/workspace_layout_manager.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 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/workspace/workspace_layout_manager.cc
diff --git a/ash/common/wm/workspace/workspace_layout_manager.cc b/ash/common/wm/workspace/workspace_layout_manager.cc
index a1a36964bb65807aa627ac6864e9efed9e645ea2..ee1fd9d591c5406262fb46dfeef2d02fd516234b 100644
--- a/ash/common/wm/workspace/workspace_layout_manager.cc
+++ b/ash/common/wm/workspace/workspace_layout_manager.cc
@@ -20,7 +20,9 @@
#include "ash/common/wm_window_property.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
+#include "ash/wm/window_state_aura.h"
#include "base/command_line.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/base/ui_base_switches.h"
#include "ui/compositor/layer.h"
#include "ui/display/display.h"
@@ -39,7 +41,7 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window)
is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr) {
shell_->AddShellObserver(this);
shell_->AddActivationObserver(this);
- root_window_->AddObserver(this);
+ root_window_->aura_window()->AddObserver(this);
display::Screen::GetScreen()->AddObserver(this);
DCHECK(window->GetBoolProperty(
WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY));
@@ -47,11 +49,11 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window)
WorkspaceLayoutManager::~WorkspaceLayoutManager() {
if (root_window_)
- root_window_->RemoveObserver(this);
+ root_window_->aura_window()->RemoveObserver(this);
for (WmWindow* window : windows_) {
wm::WindowState* window_state = window->GetWindowState();
window_state->RemoveObserver(this);
- window->RemoveObserver(this);
+ window->aura_window()->RemoveObserver(this);
}
display::Screen::GetScreen()->RemoveObserver(this);
shell_->RemoveActivationObserver(this);
@@ -73,7 +75,7 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(WmWindow* child) {
wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
window_state->OnWMEvent(&event);
windows_.insert(child);
- child->AddObserver(this);
+ child->aura_window()->AddObserver(this);
window_state->AddObserver(this);
UpdateShelfVisibility();
UpdateFullscreenState();
@@ -86,7 +88,7 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(WmWindow* child) {
void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {
windows_.erase(child);
- child->RemoveObserver(this);
+ child->aura_window()->RemoveObserver(this);
child->GetWindowState()->RemoveObserver(this);
if (child->GetTargetVisibility())
@@ -180,59 +182,59 @@ void WorkspaceLayoutManager::OnKeyboardClosed() {}
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, aura::WindowObserver implementation:
-void WorkspaceLayoutManager::OnWindowTreeChanged(
- WmWindow* window,
- const WmWindowObserver::TreeChangeParams& params) {
- if (!params.target->GetWindowState()->IsActive())
+void WorkspaceLayoutManager::OnWindowHierarchyChanged(
+ const HierarchyChangeParams& params) {
+ if (!wm::GetWindowState(params.target)->IsActive())
return;
// If the window is already tracked by the workspace this update would be
// redundant as the fullscreen and shelf state would have been handled in
// OnWindowAddedToLayout.
- if (windows_.find(params.target) != windows_.end())
+ if (windows_.find(WmWindow::Get(params.target)) != windows_.end())
return;
// If the active window has moved to this root window then update the
// fullscreen state.
// TODO(flackr): Track the active window leaving this root window and update
// the fullscreen state accordingly.
- if (params.new_parent && params.new_parent->GetRootWindow() == root_window_) {
+ if (params.new_parent &&
+ WmWindow::Get(params.new_parent->GetRootWindow()) == root_window_) {
UpdateFullscreenState();
UpdateShelfVisibility();
}
}
-void WorkspaceLayoutManager::OnWindowPropertyChanged(
- WmWindow* window,
- WmWindowProperty property) {
- if (property == WmWindowProperty::ALWAYS_ON_TOP &&
- window->GetBoolProperty(WmWindowProperty::ALWAYS_ON_TOP)) {
+void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ if (key == aura::client::kAlwaysOnTopKey &&
+ window->GetProperty(aura::client::kAlwaysOnTopKey)) {
WmWindow* container =
root_window_controller_->always_on_top_controller()->GetContainer(
- window);
- if (window->GetParent() != container)
- container->AddChild(window);
+ WmWindow::Get(window));
+ if (WmWindow::Get(window->parent()) != container)
+ container->AddChild(WmWindow::Get(window));
}
}
-void WorkspaceLayoutManager::OnWindowStackingChanged(WmWindow* window) {
+void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) {
UpdateShelfVisibility();
UpdateFullscreenState();
if (backdrop_delegate_)
- backdrop_delegate_->OnWindowStackingChanged(window);
+ backdrop_delegate_->OnWindowStackingChanged(WmWindow::Get(window));
}
-void WorkspaceLayoutManager::OnWindowDestroying(WmWindow* window) {
- if (root_window_ == window) {
- root_window_->RemoveObserver(this);
+void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {
+ if (root_window_ == WmWindow::Get(window)) {
+ root_window_->aura_window()->RemoveObserver(this);
root_window_ = nullptr;
}
}
void WorkspaceLayoutManager::OnWindowBoundsChanged(
- WmWindow* window,
+ aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
- if (root_window_ == window) {
+ if (root_window_ == WmWindow::Get(window)) {
const wm::WMEvent wm_event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED);
AdjustAllWindowsBoundsForWorkAreaChange(&wm_event);
}
« no previous file with comments | « ash/common/wm/workspace/workspace_layout_manager.h ('k') | ash/common/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698