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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 cursor_client_->ShowCursor(); | 138 cursor_client_->ShowCursor(); |
139 // TODO(flackr): Only prevent cursor changes for windows in the overview. | 139 // TODO(flackr): Only prevent cursor changes for windows in the overview. |
140 // This will be easier to do without exposing the overview mode code if the | 140 // This will be easier to do without exposing the overview mode code if the |
141 // cursor changes are moved to ToplevelWindowEventHandler::HandleMouseMoved | 141 // cursor changes are moved to ToplevelWindowEventHandler::HandleMouseMoved |
142 // as suggested there. | 142 // as suggested there. |
143 cursor_client_->LockCursor(); | 143 cursor_client_->LockCursor(); |
144 } | 144 } |
145 ash::Shell::GetInstance()->PrependPreTargetHandler(this); | 145 ash::Shell::GetInstance()->PrependPreTargetHandler(this); |
146 Shell* shell = Shell::GetInstance(); | 146 Shell* shell = Shell::GetInstance(); |
147 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); | 147 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
148 shell->OnOverviewModeStarted(); | |
148 HideAndTrackNonOverviewWindows(); | 149 HideAndTrackNonOverviewWindows(); |
149 } | 150 } |
150 | 151 |
151 WindowOverview::~WindowOverview() { | 152 WindowOverview::~WindowOverview() { |
152 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); | 153 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); |
153 for (aura::WindowTracker::Windows::const_iterator iter = | 154 for (aura::WindowTracker::Windows::const_iterator iter = |
154 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 155 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
155 ui::ScopedLayerAnimationSettings settings( | 156 ui::ScopedLayerAnimationSettings settings( |
156 (*iter)->layer()->GetAnimator()); | 157 (*iter)->layer()->GetAnimator()); |
157 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 158 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
158 ScopedTransformOverviewWindow::kTransitionMilliseconds)); | 159 ScopedTransformOverviewWindow::kTransitionMilliseconds)); |
159 settings.SetPreemptionStrategy( | 160 settings.SetPreemptionStrategy( |
160 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 161 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
161 (*iter)->Show(); | 162 (*iter)->Show(); |
162 (*iter)->layer()->SetOpacity(1); | 163 (*iter)->layer()->SetOpacity(1); |
163 } | 164 } |
164 if (cursor_client_) | 165 if (cursor_client_) |
165 cursor_client_->UnlockCursor(); | 166 cursor_client_->UnlockCursor(); |
166 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 167 Shell* shell = Shell::GetInstance(); |
168 shell->RemovePreTargetHandler(this); | |
167 UMA_HISTOGRAM_MEDIUM_TIMES( | 169 UMA_HISTOGRAM_MEDIUM_TIMES( |
168 "Ash.WindowSelector.TimeInOverview", | 170 "Ash.WindowSelector.TimeInOverview", |
169 base::Time::Now() - overview_start_time_); | 171 base::Time::Now() - overview_start_time_); |
172 shell->OnOverviewModeEnded(); | |
sky
2014/03/06 01:03:18
How about moving this to its own patch?
Mr4D (OOO till 08-26)
2014/03/06 17:17:16
It is already. Please look at the latest rev of th
| |
170 } | 173 } |
171 | 174 |
172 void WindowOverview::SetSelection(size_t index) { | 175 void WindowOverview::SetSelection(size_t index) { |
173 gfx::Rect target_bounds(GetSelectionBounds(index)); | 176 gfx::Rect target_bounds(GetSelectionBounds(index)); |
174 | 177 |
175 if (selection_widget_) { | 178 if (selection_widget_) { |
176 // If the selection widget is already active, determine the animation to | 179 // If the selection widget is already active, determine the animation to |
177 // use to animate the widget to the new bounds. | 180 // use to animate the widget to the new bounds. |
178 int change = static_cast<int>(index) - static_cast<int>(selection_index_); | 181 int change = static_cast<int>(index) - static_cast<int>(selection_index_); |
179 int windows = static_cast<int>(windows_->size()); | 182 int windows = static_cast<int>(windows_->size()); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 } | 450 } |
448 | 451 |
449 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { | 452 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { |
450 gfx::Rect bounds((*windows_)[index]->bounds()); | 453 gfx::Rect bounds((*windows_)[index]->bounds()); |
451 bounds.Inset(-kWindowOverviewSelectionPadding, | 454 bounds.Inset(-kWindowOverviewSelectionPadding, |
452 -kWindowOverviewSelectionPadding); | 455 -kWindowOverviewSelectionPadding); |
453 return bounds; | 456 return bounds; |
454 } | 457 } |
455 | 458 |
456 } // namespace ash | 459 } // namespace ash |
OLD | NEW |