| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/overview/window_grid.h" | 5 #include "ash/wm/overview/window_grid.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 window_selector_->OnGridEmpty(this); | 384 window_selector_->OnGridEmpty(this); |
| 385 return; | 385 return; |
| 386 } | 386 } |
| 387 | 387 |
| 388 // If selecting, update the selection index. | 388 // If selecting, update the selection index. |
| 389 if (selection_widget_) { | 389 if (selection_widget_) { |
| 390 bool send_focus_alert = selected_index_ == removed_index; | 390 bool send_focus_alert = selected_index_ == removed_index; |
| 391 if (selected_index_ >= removed_index && selected_index_ != 0) | 391 if (selected_index_ >= removed_index && selected_index_ != 0) |
| 392 selected_index_--; | 392 selected_index_--; |
| 393 if (send_focus_alert) | 393 if (send_focus_alert) |
| 394 SelectedWindow()->SendFocusAlert(); | 394 SelectedWindow()->SendAccessibleSelectionEvent(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 PositionWindows(true); | 397 PositionWindows(true); |
| 398 } | 398 } |
| 399 | 399 |
| 400 void WindowGrid::OnWindowBoundsChanged(aura::Window* window, | 400 void WindowGrid::OnWindowBoundsChanged(aura::Window* window, |
| 401 const gfx::Rect& old_bounds, | 401 const gfx::Rect& old_bounds, |
| 402 const gfx::Rect& new_bounds) { | 402 const gfx::Rect& new_bounds) { |
| 403 ScopedVector<WindowSelectorItem>::const_iterator iter = | 403 ScopedVector<WindowSelectorItem>::const_iterator iter = |
| 404 std::find_if(window_list_.begin(), window_list_.end(), | 404 std::find_if(window_list_.begin(), window_list_.end(), |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 old_selection->GetNativeWindow()->bounds() + fade_out_direction); | 483 old_selection->GetNativeWindow()->bounds() + fade_out_direction); |
| 484 old_selection->Hide(); | 484 old_selection->Hide(); |
| 485 } | 485 } |
| 486 if (out_of_bounds) | 486 if (out_of_bounds) |
| 487 return; | 487 return; |
| 488 | 488 |
| 489 if (!selection_widget_) | 489 if (!selection_widget_) |
| 490 InitSelectionWidget(direction); | 490 InitSelectionWidget(direction); |
| 491 // Send an a11y alert so that if ChromeVox is enabled, the item label is | 491 // Send an a11y alert so that if ChromeVox is enabled, the item label is |
| 492 // read. | 492 // read. |
| 493 SelectedWindow()->SendFocusAlert(); | 493 SelectedWindow()->SendAccessibleSelectionEvent(); |
| 494 // The selection widget is moved to the newly selected item in the same | 494 // The selection widget is moved to the newly selected item in the same |
| 495 // grid. | 495 // grid. |
| 496 MoveSelectionWidgetToTarget(animate); | 496 MoveSelectionWidgetToTarget(animate); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void WindowGrid::MoveSelectionWidgetToTarget(bool animate) { | 499 void WindowGrid::MoveSelectionWidgetToTarget(bool animate) { |
| 500 if (animate) { | 500 if (animate) { |
| 501 ui::ScopedLayerAnimationSettings animation_settings( | 501 ui::ScopedLayerAnimationSettings animation_settings( |
| 502 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); | 502 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); |
| 503 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 503 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
| 504 kOverviewSelectorTransitionMilliseconds)); | 504 kOverviewSelectorTransitionMilliseconds)); |
| 505 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); | 505 animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); |
| 506 animation_settings.SetPreemptionStrategy( | 506 animation_settings.SetPreemptionStrategy( |
| 507 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 507 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 508 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 508 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
| 509 selection_widget_->SetOpacity(255); | 509 selection_widget_->SetOpacity(255); |
| 510 return; | 510 return; |
| 511 } | 511 } |
| 512 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); | 512 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); |
| 513 selection_widget_->SetOpacity(255); | 513 selection_widget_->SetOpacity(255); |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace ash | 516 } // namespace ash |
| OLD | NEW |