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)->Show(); |
163 (*iter)->layer()->SetOpacity(1); | 164 (*iter)->layer()->SetOpacity(1); |
164 (*iter)->Show(); | |
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(); | |
221 old_selection->layer()->SetOpacity(0); | 220 old_selection->layer()->SetOpacity(0); |
222 InitializeSelectionWidget(); | 221 InitializeSelectionWidget(); |
223 selection_widget_->GetNativeWindow()->SetBoundsInScreen( | 222 selection_widget_->GetNativeWindow()->SetBoundsInScreen( |
224 target_bounds - fade_out_direction, dst_display); | 223 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); | |
227 } | 224 } |
228 ui::ScopedLayerAnimationSettings animation_settings( | 225 ui::ScopedLayerAnimationSettings animation_settings( |
229 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); | 226 selection_widget_->GetNativeWindow()->layer()->GetAnimator()); |
230 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 227 animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
231 kOverviewSelectorTransitionMilliseconds)); | 228 kOverviewSelectorTransitionMilliseconds)); |
232 animation_settings.SetPreemptionStrategy( | 229 animation_settings.SetPreemptionStrategy( |
233 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 230 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
234 selection_widget_->SetBounds(target_bounds); | 231 selection_widget_->SetBounds(target_bounds); |
235 selection_widget_->GetNativeWindow()->layer()->SetOpacity( | 232 selection_widget_->GetNativeWindow()->layer()->SetOpacity( |
236 kWindowOverviewSelectionOpacity); | 233 kWindowOverviewSelectionOpacity); |
237 } else { | 234 } else { |
238 InitializeSelectionWidget(); | 235 InitializeSelectionWidget(); |
239 selection_widget_->SetBounds(target_bounds); | 236 selection_widget_->SetBounds(target_bounds); |
| 237 selection_widget_->GetNativeWindow()->layer()->SetOpacity( |
| 238 kWindowOverviewSelectionOpacity); |
240 } | 239 } |
241 selection_index_ = index; | 240 selection_index_ = index; |
242 } | 241 } |
243 | 242 |
244 void WindowOverview::OnWindowsChanged() { | 243 void WindowOverview::OnWindowsChanged() { |
245 PositionWindows(); | 244 PositionWindows(); |
246 } | 245 } |
247 | 246 |
248 void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { | 247 void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { |
249 single_root_window_ = root_window; | 248 single_root_window_ = root_window; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 params.accept_events = false; | 440 params.accept_events = false; |
442 selection_widget_->set_focus_on_creation(false); | 441 selection_widget_->set_focus_on_creation(false); |
443 selection_widget_->Init(params); | 442 selection_widget_->Init(params); |
444 views::View* content_view = new views::View; | 443 views::View* content_view = new views::View; |
445 content_view->set_background( | 444 content_view->set_background( |
446 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); | 445 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); |
447 selection_widget_->SetContentsView(content_view); | 446 selection_widget_->SetContentsView(content_view); |
448 selection_widget_->Show(); | 447 selection_widget_->Show(); |
449 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( | 448 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( |
450 selection_widget_->GetNativeWindow()); | 449 selection_widget_->GetNativeWindow()); |
451 selection_widget_->GetNativeWindow()->layer()->SetOpacity( | 450 selection_widget_->GetNativeWindow()->layer()->SetOpacity(0); |
452 kWindowOverviewSelectionOpacity); | |
453 } | 451 } |
454 | 452 |
455 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { | 453 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { |
456 gfx::Rect bounds((*windows_)[index]->bounds()); | 454 gfx::Rect bounds((*windows_)[index]->bounds()); |
457 bounds.Inset(-kWindowOverviewSelectionPadding, | 455 bounds.Inset(-kWindowOverviewSelectionPadding, |
458 -kWindowOverviewSelectionPadding); | 456 -kWindowOverviewSelectionPadding); |
459 return bounds; | 457 return bounds; |
460 } | 458 } |
461 | 459 |
462 } // namespace ash | 460 } // namespace ash |
OLD | NEW |