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/overview/window_overview.h" | 5 #include "ash/wm/overview/window_overview.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/metrics/user_metrics_recorder.h" | 9 #include "ash/metrics/user_metrics_recorder.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 WindowOverview::~WindowOverview() { | 153 WindowOverview::~WindowOverview() { |
154 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); | 154 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); |
155 for (aura::WindowTracker::Windows::const_iterator iter = | 155 for (aura::WindowTracker::Windows::const_iterator iter = |
156 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 156 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
157 ui::ScopedLayerAnimationSettings settings( | 157 ui::ScopedLayerAnimationSettings settings( |
158 (*iter)->layer()->GetAnimator()); | 158 (*iter)->layer()->GetAnimator()); |
159 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 159 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
160 ScopedTransformOverviewWindow::kTransitionMilliseconds)); | 160 ScopedTransformOverviewWindow::kTransitionMilliseconds)); |
161 settings.SetPreemptionStrategy( | 161 settings.SetPreemptionStrategy( |
162 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 162 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 163 (*iter)->layer()->SetOpacity(1); |
163 (*iter)->Show(); | 164 (*iter)->Show(); |
164 (*iter)->layer()->SetOpacity(1); | |
165 } | 165 } |
166 if (cursor_client_) | 166 if (cursor_client_) |
167 cursor_client_->UnlockCursor(); | 167 cursor_client_->UnlockCursor(); |
168 ash::Shell* shell = ash::Shell::GetInstance(); | 168 ash::Shell* shell = ash::Shell::GetInstance(); |
169 shell->RemovePreTargetHandler(this); | 169 shell->RemovePreTargetHandler(this); |
170 UMA_HISTOGRAM_MEDIUM_TIMES( | 170 UMA_HISTOGRAM_MEDIUM_TIMES( |
171 "Ash.WindowSelector.TimeInOverview", | 171 "Ash.WindowSelector.TimeInOverview", |
172 base::Time::Now() - overview_start_time_); | 172 base::Time::Now() - overview_start_time_); |
173 shell->OnOverviewModeEnding(); | 173 shell->OnOverviewModeEnding(); |
174 } | 174 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 ui::ScopedLayerAnimationSettings animation_settings( | 210 ui::ScopedLayerAnimationSettings animation_settings( |
211 old_selection->layer()->GetAnimator()); | 211 old_selection->layer()->GetAnimator()); |
212 animation_settings.SetTransitionDuration( | 212 animation_settings.SetTransitionDuration( |
213 base::TimeDelta::FromMilliseconds( | 213 base::TimeDelta::FromMilliseconds( |
214 kOverviewSelectorTransitionMilliseconds)); | 214 kOverviewSelectorTransitionMilliseconds)); |
215 animation_settings.SetPreemptionStrategy( | 215 animation_settings.SetPreemptionStrategy( |
216 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 216 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
217 old_selection->SetBoundsInScreen( | 217 old_selection->SetBoundsInScreen( |
218 GetSelectionBounds(selection_index_) + fade_out_direction, | 218 GetSelectionBounds(selection_index_) + fade_out_direction, |
219 dst_display); | 219 dst_display); |
| 220 old_selection->Hide(); |
220 old_selection->layer()->SetOpacity(0); | 221 old_selection->layer()->SetOpacity(0); |
221 InitializeSelectionWidget(); | 222 InitializeSelectionWidget(); |
222 selection_widget_->GetNativeWindow()->SetBoundsInScreen( | 223 selection_widget_->GetNativeWindow()->SetBoundsInScreen( |
223 target_bounds - fade_out_direction, dst_display); | 224 target_bounds - fade_out_direction, dst_display); |
| 225 // New selection widget starts with 0 opacity and fades in. |
| 226 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0); |
224 } | 227 } |
225 ui::ScopedLayerAnimationSettings animation_settings( | 228 ui::ScopedLayerAnimationSettings animation_settings( |
226 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); | 229 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); |
227 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 230 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
228 kOverviewSelectorTransitionMilliseconds)); | 231 kOverviewSelectorTransitionMilliseconds)); |
229 animation_settings.SetPreemptionStrategy( | 232 animation_settings.SetPreemptionStrategy( |
230 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 233 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
231 selection_widget_->SetBounds(target_bounds); | 234 selection_widget_->SetBounds(target_bounds); |
232 selection_widget_->GetNativeWindow()->layer()->SetOpacity( | 235 selection_widget_->GetNativeWindow()->layer()->SetOpacity( |
233 kWindowOverviewSelectionOpacity); | 236 kWindowOverviewSelectionOpacity); |
234 } else { | 237 } else { |
235 InitializeSelectionWidget(); | 238 InitializeSelectionWidget(); |
236 selection_widget_->SetBounds(target_bounds); | 239 selection_widget_->SetBounds(target_bounds); |
237 selection_widget_->GetNativeWindow()->layer()->SetOpacity( | |
238 kWindowOverviewSelectionOpacity); | |
239 } | 240 } |
240 selection_index_ = index; | 241 selection_index_ = index; |
241 } | 242 } |
242 | 243 |
243 void WindowOverview::OnWindowsChanged() { | 244 void WindowOverview::OnWindowsChanged() { |
244 PositionWindows(); | 245 PositionWindows(); |
245 } | 246 } |
246 | 247 |
247 void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { | 248 void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { |
248 single_root_window_ = root_window; | 249 single_root_window_ = root_window; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 params.accept_events = false; | 441 params.accept_events = false; |
441 selection_widget_->set_focus_on_creation(false); | 442 selection_widget_->set_focus_on_creation(false); |
442 selection_widget_->Init(params); | 443 selection_widget_->Init(params); |
443 views::View* content_view = new views::View; | 444 views::View* content_view = new views::View; |
444 content_view->set_background( | 445 content_view->set_background( |
445 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); | 446 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); |
446 selection_widget_->SetContentsView(content_view); | 447 selection_widget_->SetContentsView(content_view); |
447 selection_widget_->Show(); | 448 selection_widget_->Show(); |
448 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( | 449 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( |
449 selection_widget_->GetNativeWindow()); | 450 selection_widget_->GetNativeWindow()); |
450 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0); | 451 selection_widget_->GetNativeWindow()->layer()->SetOpacity( |
| 452 kWindowOverviewSelectionOpacity); |
451 } | 453 } |
452 | 454 |
453 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { | 455 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { |
454 gfx::Rect bounds((*windows_)[index]->bounds()); | 456 gfx::Rect bounds((*windows_)[index]->bounds()); |
455 bounds.Inset(-kWindowOverviewSelectionPadding, | 457 bounds.Inset(-kWindowOverviewSelectionPadding, |
456 -kWindowOverviewSelectionPadding); | 458 -kWindowOverviewSelectionPadding); |
457 return bounds; | 459 return bounds; |
458 } | 460 } |
459 | 461 |
460 } // namespace ash | 462 } // namespace ash |
OLD | NEW |