| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/window_state.h" | 5 #include "ash/wm/window_state.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return false; | 168 return false; |
| 169 | 169 |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 | 172 |
| 173 bool WindowState::CanResize() const { | 173 bool WindowState::CanResize() const { |
| 174 return window_->GetProperty(aura::client::kCanResizeKey); | 174 return window_->GetProperty(aura::client::kCanResizeKey); |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool WindowState::CanActivate() const { | 177 bool WindowState::CanActivate() const { |
| 178 return views::corewm::CanActivateWindow(window_); | 178 return ::wm::CanActivateWindow(window_); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool WindowState::CanSnap() const { | 181 bool WindowState::CanSnap() const { |
| 182 if (!CanResize() || window_->type() == ui::wm::WINDOW_TYPE_PANEL || | 182 if (!CanResize() || window_->type() == ui::wm::WINDOW_TYPE_PANEL || |
| 183 views::corewm::GetTransientParent(window_)) | 183 ::wm::GetTransientParent(window_)) |
| 184 return false; | 184 return false; |
| 185 // If a window has a maximum size defined, snapping may make it too big. | 185 // If a window has a maximum size defined, snapping may make it too big. |
| 186 // TODO(oshima): We probably should snap if possible. | 186 // TODO(oshima): We probably should snap if possible. |
| 187 return window_->delegate() ? window_->delegate()->GetMaximumSize().IsEmpty() : | 187 return window_->delegate() ? window_->delegate()->GetMaximumSize().IsEmpty() : |
| 188 true; | 188 true; |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool WindowState::HasRestoreBounds() const { | 191 bool WindowState::HasRestoreBounds() const { |
| 192 return window_->GetProperty(aura::client::kRestoreBoundsKey) != NULL; | 192 return window_->GetProperty(aura::client::kRestoreBoundsKey) != NULL; |
| 193 } | 193 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 376 } |
| 377 | 377 |
| 378 const gfx::Rect old_bounds = window_->bounds(); | 378 const gfx::Rect old_bounds = window_->bounds(); |
| 379 | 379 |
| 380 // Create fresh layers for the window and all its children to paint into. | 380 // Create fresh layers for the window and all its children to paint into. |
| 381 // Takes ownership of the old layer and all its children, which will be | 381 // Takes ownership of the old layer and all its children, which will be |
| 382 // cleaned up after the animation completes. | 382 // cleaned up after the animation completes. |
| 383 // Specify |set_bounds| to true here to keep the old bounds in the child | 383 // Specify |set_bounds| to true here to keep the old bounds in the child |
| 384 // windows of |window|. | 384 // windows of |window|. |
| 385 scoped_ptr<ui::LayerTreeOwner> old_layer_owner = | 385 scoped_ptr<ui::LayerTreeOwner> old_layer_owner = |
| 386 views::corewm::RecreateLayers(window_); | 386 ::wm::RecreateLayers(window_); |
| 387 ui::Layer* old_layer = old_layer_owner->root(); | 387 ui::Layer* old_layer = old_layer_owner->root(); |
| 388 DCHECK(old_layer); | 388 DCHECK(old_layer); |
| 389 ui::Layer* new_layer = window_->layer(); | 389 ui::Layer* new_layer = window_->layer(); |
| 390 | 390 |
| 391 // Resize the window to the new size, which will force a layout and paint. | 391 // Resize the window to the new size, which will force a layout and paint. |
| 392 SetBoundsDirect(new_bounds); | 392 SetBoundsDirect(new_bounds); |
| 393 | 393 |
| 394 // Ensure the higher-resolution layer is on top. | 394 // Ensure the higher-resolution layer is on top. |
| 395 bool old_on_top = (old_bounds.width() > new_bounds.width()); | 395 bool old_on_top = (old_bounds.width() > new_bounds.width()); |
| 396 if (old_on_top) | 396 if (old_on_top) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 416 } | 416 } |
| 417 return settings; | 417 return settings; |
| 418 } | 418 } |
| 419 | 419 |
| 420 const WindowState* GetWindowState(const aura::Window* window) { | 420 const WindowState* GetWindowState(const aura::Window* window) { |
| 421 return GetWindowState(const_cast<aura::Window*>(window)); | 421 return GetWindowState(const_cast<aura::Window*>(window)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace wm | 424 } // namespace wm |
| 425 } // namespace ash | 425 } // namespace ash |
| OLD | NEW |