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/accessibility_delegate.h" | |
9 #include "ash/metrics/user_metrics_recorder.h" | 10 #include "ash/metrics/user_metrics_recorder.h" |
10 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
12 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
13 #include "ash/switchable_windows.h" | 14 #include "ash/switchable_windows.h" |
14 #include "ash/wm/overview/scoped_transform_overview_window.h" | 15 #include "ash/wm/overview/scoped_transform_overview_window.h" |
15 #include "ash/wm/overview/window_selector.h" | 16 #include "ash/wm/overview/window_selector.h" |
16 #include "ash/wm/overview/window_selector_item.h" | 17 #include "ash/wm/overview/window_selector_item.h" |
17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 // TODO(flackr): Only prevent cursor changes for windows in the overview. | 144 // TODO(flackr): Only prevent cursor changes for windows in the overview. |
144 // This will be easier to do without exposing the overview mode code if the | 145 // This will be easier to do without exposing the overview mode code if the |
145 // cursor changes are moved to ToplevelWindowEventHandler::HandleMouseMoved | 146 // cursor changes are moved to ToplevelWindowEventHandler::HandleMouseMoved |
146 // as suggested there. | 147 // as suggested there. |
147 cursor_client_->LockCursor(); | 148 cursor_client_->LockCursor(); |
148 } | 149 } |
149 shell->PrependPreTargetHandler(this); | 150 shell->PrependPreTargetHandler(this); |
150 shell->GetScreen()->AddObserver(this); | 151 shell->GetScreen()->AddObserver(this); |
151 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); | 152 shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
152 HideAndTrackNonOverviewWindows(); | 153 HideAndTrackNonOverviewWindows(); |
154 // Send an a11y alert only if the overview was activated by the user. | |
155 if (window_selector_->mode() == WindowSelector::OVERVIEW) | |
flackr
2014/04/29 14:21:16
nit: need braces { } since the code block is multi
Nina
2014/04/29 14:24:34
Done.
| |
156 shell->accessibility_delegate()->TriggerAccessibilityAlert( | |
157 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); | |
153 } | 158 } |
154 | 159 |
155 WindowOverview::~WindowOverview() { | 160 WindowOverview::~WindowOverview() { |
156 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); | 161 const aura::WindowTracker::Windows hidden_windows = hidden_windows_.windows(); |
157 for (aura::WindowTracker::Windows::const_iterator iter = | 162 for (aura::WindowTracker::Windows::const_iterator iter = |
158 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { | 163 hidden_windows.begin(); iter != hidden_windows.end(); ++iter) { |
159 ui::ScopedLayerAnimationSettings settings( | 164 ui::ScopedLayerAnimationSettings settings( |
160 (*iter)->layer()->GetAnimator()); | 165 (*iter)->layer()->GetAnimator()); |
161 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( | 166 settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds( |
162 ScopedTransformOverviewWindow::kTransitionMilliseconds)); | 167 ScopedTransformOverviewWindow::kTransitionMilliseconds)); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 } | 473 } |
469 | 474 |
470 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { | 475 gfx::Rect WindowOverview::GetSelectionBounds(size_t index) { |
471 gfx::Rect bounds((*windows_)[index]->bounds()); | 476 gfx::Rect bounds((*windows_)[index]->bounds()); |
472 bounds.Inset(-kWindowOverviewSelectionPadding, | 477 bounds.Inset(-kWindowOverviewSelectionPadding, |
473 -kWindowOverviewSelectionPadding); | 478 -kWindowOverviewSelectionPadding); |
474 return bounds; | 479 return bounds; |
475 } | 480 } |
476 | 481 |
477 } // namespace ash | 482 } // namespace ash |
OLD | NEW |