| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_animations.h" | 5 #include "ash/wm/window_animations.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/screen_util.h" | 12 #include "ash/screen_util.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_layout_manager.h" | 14 #include "ash/shelf/shelf_layout_manager.h" |
| 15 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
| 16 #include "ash/wm/common/window_animation_types.h" |
| 16 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 17 #include "ash/wm/workspace_controller.h" | 18 #include "ash/wm/workspace_controller.h" |
| 18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 19 #include "base/compiler_specific.h" | 20 #include "base/compiler_specific.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
| 22 #include "base/stl_util.h" | 23 #include "base/stl_util.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 24 #include "ui/aura/client/aura_constants.h" | 25 #include "ui/aura/client/aura_constants.h" |
| 25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 AnimateShowHideWindowCommon_BrightnessGrayscale(window, false); | 221 AnimateShowHideWindowCommon_BrightnessGrayscale(window, false); |
| 221 } | 222 } |
| 222 | 223 |
| 223 bool AnimateShowWindow(aura::Window* window) { | 224 bool AnimateShowWindow(aura::Window* window) { |
| 224 if (!::wm::HasWindowVisibilityAnimationTransition( | 225 if (!::wm::HasWindowVisibilityAnimationTransition( |
| 225 window, ::wm::ANIMATE_SHOW)) { | 226 window, ::wm::ANIMATE_SHOW)) { |
| 226 return false; | 227 return false; |
| 227 } | 228 } |
| 228 | 229 |
| 229 switch (::wm::GetWindowVisibilityAnimationType(window)) { | 230 switch (::wm::GetWindowVisibilityAnimationType(window)) { |
| 230 case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: | 231 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: |
| 231 AnimateShowWindow_Minimize(window); | 232 AnimateShowWindow_Minimize(window); |
| 232 return true; | 233 return true; |
| 233 case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: | 234 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: |
| 234 AnimateShowWindow_BrightnessGrayscale(window); | 235 AnimateShowWindow_BrightnessGrayscale(window); |
| 235 return true; | 236 return true; |
| 236 default: | 237 default: |
| 237 NOTREACHED(); | 238 NOTREACHED(); |
| 238 return false; | 239 return false; |
| 239 } | 240 } |
| 240 } | 241 } |
| 241 | 242 |
| 242 bool AnimateHideWindow(aura::Window* window) { | 243 bool AnimateHideWindow(aura::Window* window) { |
| 243 if (!::wm::HasWindowVisibilityAnimationTransition( | 244 if (!::wm::HasWindowVisibilityAnimationTransition( |
| 244 window, ::wm::ANIMATE_HIDE)) { | 245 window, ::wm::ANIMATE_HIDE)) { |
| 245 return false; | 246 return false; |
| 246 } | 247 } |
| 247 | 248 |
| 248 switch (::wm::GetWindowVisibilityAnimationType(window)) { | 249 switch (::wm::GetWindowVisibilityAnimationType(window)) { |
| 249 case WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: | 250 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE: |
| 250 AnimateHideWindow_Minimize(window); | 251 AnimateHideWindow_Minimize(window); |
| 251 return true; | 252 return true; |
| 252 case WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: | 253 case wm::WINDOW_VISIBILITY_ANIMATION_TYPE_BRIGHTNESS_GRAYSCALE: |
| 253 AnimateHideWindow_BrightnessGrayscale(window); | 254 AnimateHideWindow_BrightnessGrayscale(window); |
| 254 return true; | 255 return true; |
| 255 default: | 256 default: |
| 256 NOTREACHED(); | 257 NOTREACHED(); |
| 257 return false; | 258 return false; |
| 258 } | 259 } |
| 259 } | 260 } |
| 260 | 261 |
| 261 // Observer for a window cross-fade animation. If either the window closes or | 262 // Observer for a window cross-fade animation. If either the window closes or |
| 262 // the layer's animation completes or compositing is aborted due to GPU crash, | 263 // the layer's animation completes or compositing is aborted due to GPU crash, |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 gfx::Rect work_area = | 485 gfx::Rect work_area = |
| 485 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 486 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
| 486 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); | 487 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); |
| 487 return shelf->SelectValueForShelfAlignment( | 488 return shelf->SelectValueForShelfAlignment( |
| 488 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), | 489 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), |
| 489 gfx::Rect(work_area.x(), work_area.y(), 0, 0), | 490 gfx::Rect(work_area.x(), work_area.y(), 0, 0), |
| 490 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); | 491 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace ash | 494 } // namespace ash |
| OLD | NEW |