| 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> |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return AnimateShowWindow(window); | 380 return AnimateShowWindow(window); |
| 381 // Don't start hiding the window again if it's already being hidden. | 381 // Don't start hiding the window again if it's already being hidden. |
| 382 return window->layer()->GetTargetOpacity() != 0.0f && | 382 return window->layer()->GetTargetOpacity() != 0.0f && |
| 383 AnimateHideWindow(window); | 383 AnimateHideWindow(window); |
| 384 } | 384 } |
| 385 | 385 |
| 386 std::vector<ui::LayerAnimationSequence*> | 386 std::vector<ui::LayerAnimationSequence*> |
| 387 CreateBrightnessGrayscaleAnimationSequence(float target_value, | 387 CreateBrightnessGrayscaleAnimationSequence(float target_value, |
| 388 base::TimeDelta duration) { | 388 base::TimeDelta duration) { |
| 389 gfx::Tween::Type animation_type = gfx::Tween::EASE_OUT; | 389 gfx::Tween::Type animation_type = gfx::Tween::EASE_OUT; |
| 390 std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence( | 390 ui::LayerAnimationSequence* brightness_sequence = |
| 391 new ui::LayerAnimationSequence()); | 391 new ui::LayerAnimationSequence(); |
| 392 std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence( | 392 ui::LayerAnimationSequence* grayscale_sequence = |
| 393 new ui::LayerAnimationSequence()); | 393 new ui::LayerAnimationSequence(); |
| 394 | 394 |
| 395 std::unique_ptr<ui::LayerAnimationElement> brightness_element( | 395 ui::LayerAnimationElement* brightness_element = |
| 396 ui::LayerAnimationElement::CreateBrightnessElement(target_value, | 396 ui::LayerAnimationElement::CreateBrightnessElement(target_value, |
| 397 duration)); | 397 duration); |
| 398 brightness_element->set_tween_type(animation_type); | 398 brightness_element->set_tween_type(animation_type); |
| 399 brightness_sequence->AddElement(brightness_element.release()); | 399 brightness_sequence->AddElement(brightness_element); |
| 400 | 400 |
| 401 std::unique_ptr<ui::LayerAnimationElement> grayscale_element( | 401 ui::LayerAnimationElement* grayscale_element = |
| 402 ui::LayerAnimationElement::CreateGrayscaleElement(target_value, | 402 ui::LayerAnimationElement::CreateGrayscaleElement(target_value, duration); |
| 403 duration)); | |
| 404 grayscale_element->set_tween_type(animation_type); | 403 grayscale_element->set_tween_type(animation_type); |
| 405 grayscale_sequence->AddElement(grayscale_element.release()); | 404 grayscale_sequence->AddElement(grayscale_element); |
| 406 | 405 |
| 407 std::vector<ui::LayerAnimationSequence*> animations; | 406 std::vector<ui::LayerAnimationSequence*> animations; |
| 408 animations.push_back(brightness_sequence.release()); | 407 animations.push_back(brightness_sequence); |
| 409 animations.push_back(grayscale_sequence.release()); | 408 animations.push_back(grayscale_sequence); |
| 410 | 409 |
| 411 return animations; | 410 return animations; |
| 412 } | 411 } |
| 413 | 412 |
| 414 gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { | 413 gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { |
| 415 WmWindow* wm_window = WmWindowAura::Get(window); | 414 WmWindow* wm_window = WmWindowAura::Get(window); |
| 416 WmShelf* shelf = WmShelf::ForWindow(wm_window); | 415 WmShelf* shelf = WmShelf::ForWindow(wm_window); |
| 417 gfx::Rect item_rect = shelf->GetScreenBoundsOfItemIconForWindow(wm_window); | 416 gfx::Rect item_rect = shelf->GetScreenBoundsOfItemIconForWindow(wm_window); |
| 418 | 417 |
| 419 // The launcher item is visible and has an icon. | 418 // The launcher item is visible and has an icon. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 case SHELF_ALIGNMENT_LEFT: | 450 case SHELF_ALIGNMENT_LEFT: |
| 452 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); | 451 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); |
| 453 case SHELF_ALIGNMENT_RIGHT: | 452 case SHELF_ALIGNMENT_RIGHT: |
| 454 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); | 453 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); |
| 455 } | 454 } |
| 456 NOTREACHED(); | 455 NOTREACHED(); |
| 457 return gfx::Rect(); | 456 return gfx::Rect(); |
| 458 } | 457 } |
| 459 | 458 |
| 460 } // namespace ash | 459 } // namespace ash |
| OLD | NEW |