| 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/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_delegate.h" |
| 11 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 12 #include "ash/wm/overview/window_selector.h" | 13 #include "ash/wm/overview/window_selector.h" |
| 13 #include "ash/wm/overview/window_selector_item.h" | 14 #include "ash/wm/overview/window_selector_item.h" |
| 15 #include "base/metrics/histogram.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 16 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 17 #include "ui/compositor/scoped_layer_animation_settings.h" | 19 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 18 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
| 19 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 20 | 22 |
| 21 namespace ash { | 23 namespace ash { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 const aura::Window* target; | 46 const aura::Window* target; |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace | 49 } // namespace |
| 48 | 50 |
| 49 WindowOverview::WindowOverview(WindowSelector* window_selector, | 51 WindowOverview::WindowOverview(WindowSelector* window_selector, |
| 50 WindowSelectorItemList* windows, | 52 WindowSelectorItemList* windows, |
| 51 aura::RootWindow* single_root_window) | 53 aura::RootWindow* single_root_window) |
| 52 : window_selector_(window_selector), | 54 : window_selector_(window_selector), |
| 53 windows_(windows), | 55 windows_(windows), |
| 54 single_root_window_(single_root_window) { | 56 single_root_window_(single_root_window), |
| 57 overview_start_time_(base::Time::Now()) { |
| 55 PositionWindows(); | 58 PositionWindows(); |
| 56 ash::Shell::GetInstance()->AddPreTargetHandler(this); | 59 ash::Shell::GetInstance()->AddPreTargetHandler(this); |
| 60 Shell* shell = Shell::GetInstance(); |
| 61 shell->delegate()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
| 57 } | 62 } |
| 58 | 63 |
| 59 WindowOverview::~WindowOverview() { | 64 WindowOverview::~WindowOverview() { |
| 60 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 65 ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
| 66 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 67 "Ash.WindowSelector.TimeInOverview", |
| 68 base::Time::Now() - overview_start_time_); |
| 61 } | 69 } |
| 62 | 70 |
| 63 void WindowOverview::SetSelection(size_t index) { | 71 void WindowOverview::SetSelection(size_t index) { |
| 64 DCHECK_LT(index, windows_->size()); | 72 DCHECK_LT(index, windows_->size()); |
| 65 gfx::Rect target_bounds = (*windows_)[index]->bounds(); | 73 gfx::Rect target_bounds = (*windows_)[index]->bounds(); |
| 66 target_bounds.Inset(-kWindowOverviewSelectionPadding, | 74 target_bounds.Inset(-kWindowOverviewSelectionPadding, |
| 67 -kWindowOverviewSelectionPadding); | 75 -kWindowOverviewSelectionPadding); |
| 68 | 76 |
| 69 if (selection_widget_) { | 77 if (selection_widget_) { |
| 70 // If the selection widget is already active, animate to the new bounds. | 78 // If the selection widget is already active, animate to the new bounds. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); | 245 views::Background::CreateSolidBackground(kWindowOverviewSelectionColor)); |
| 238 selection_widget_->SetContentsView(content_view); | 246 selection_widget_->SetContentsView(content_view); |
| 239 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( | 247 selection_widget_->GetNativeWindow()->parent()->StackChildAtBottom( |
| 240 selection_widget_->GetNativeWindow()); | 248 selection_widget_->GetNativeWindow()); |
| 241 selection_widget_->Show(); | 249 selection_widget_->Show(); |
| 242 selection_widget_->GetNativeWindow()->layer()->SetOpacity( | 250 selection_widget_->GetNativeWindow()->layer()->SetOpacity( |
| 243 kWindowOverviewSelectionOpacity); | 251 kWindowOverviewSelectionOpacity); |
| 244 } | 252 } |
| 245 | 253 |
| 246 } // namespace ash | 254 } // namespace ash |
| OLD | NEW |