| 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/common/wm/overview/window_selector.h" | 5 #include "ash/common/wm/overview/window_selector.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 textfield->RequestFocus(); | 257 textfield->RequestFocus(); |
| 258 | 258 |
| 259 return widget; | 259 return widget; |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace | 262 } // namespace |
| 263 | 263 |
| 264 // static | 264 // static |
| 265 bool WindowSelector::IsSelectable(WmWindow* window) { | 265 bool WindowSelector::IsSelectable(WmWindow* window) { |
| 266 wm::WindowState* state = window->GetWindowState(); | 266 wm::WindowState* state = window->GetWindowState(); |
| 267 if (state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED || | 267 if (!ash::MaterialDesignController::IsOverviewMaterial() && |
| 268 state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED) { | 268 (state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED || |
| 269 state->GetStateType() == wm::WINDOW_STATE_TYPE_DOCKED_MINIMIZED)) { |
| 269 return false; | 270 return false; |
| 270 } | 271 } |
| 271 return state->IsUserPositionable(); | 272 return state->IsUserPositionable(); |
| 272 } | 273 } |
| 273 | 274 |
| 274 WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) | 275 WindowSelector::WindowSelector(WindowSelectorDelegate* delegate) |
| 275 : delegate_(delegate), | 276 : delegate_(delegate), |
| 276 restore_focus_window_(WmShell::Get()->GetFocusedWindow()), | 277 restore_focus_window_(WmShell::Get()->GetFocusedWindow()), |
| 277 ignore_activations_(false), | 278 ignore_activations_(false), |
| 278 selected_grid_index_(0), | 279 selected_grid_index_(0), |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 WmShell::Get()->GetAccessibilityDelegate()->TriggerAccessibilityAlert( | 373 WmShell::Get()->GetAccessibilityDelegate()->TriggerAccessibilityAlert( |
| 373 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); | 374 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); |
| 374 | 375 |
| 375 UpdateShelfVisibility(); | 376 UpdateShelfVisibility(); |
| 376 } | 377 } |
| 377 | 378 |
| 378 // NOTE: The work done in Shutdown() is not done in the destructor because it | 379 // NOTE: The work done in Shutdown() is not done in the destructor because it |
| 379 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect | 380 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect |
| 380 // calls to restoring_minimized_windows() on a partially destructed object. | 381 // calls to restoring_minimized_windows() on a partially destructed object. |
| 381 void WindowSelector::Shutdown() { | 382 void WindowSelector::Shutdown() { |
| 383 size_t remaining_items = 0; |
| 384 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
| 385 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) |
| 386 window_selector_item->RestoreWindow(); |
| 387 remaining_items += window_grid->size(); |
| 388 } |
| 389 |
| 390 // Setting focus after restoring windows' state avoids unnecessary animations. |
| 382 ResetFocusRestoreWindow(true); | 391 ResetFocusRestoreWindow(true); |
| 383 RemoveAllObservers(); | 392 RemoveAllObservers(); |
| 384 | 393 |
| 385 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); | 394 std::vector<WmWindow*> root_windows = WmShell::Get()->GetAllRootWindows(); |
| 386 for (WmWindow* window : root_windows) { | 395 for (WmWindow* window : root_windows) { |
| 387 // Un-hide the callout widgets for panels. It is safe to call this for | 396 // Un-hide the callout widgets for panels. It is safe to call this for |
| 388 // root_windows that don't contain any panel windows. | 397 // root_windows that don't contain any panel windows. |
| 389 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); | 398 PanelLayoutManager::Get(window)->SetShowCalloutWidgets(true); |
| 390 } | 399 } |
| 391 | 400 |
| 392 size_t remaining_items = 0; | |
| 393 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | |
| 394 for (WindowSelectorItem* window_selector_item : window_grid->window_list()) | |
| 395 window_selector_item->RestoreWindow(); | |
| 396 remaining_items += window_grid->size(); | |
| 397 } | |
| 398 | |
| 399 DCHECK(num_items_ >= remaining_items); | 401 DCHECK(num_items_ >= remaining_items); |
| 400 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", | 402 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.OverviewClosedItems", |
| 401 num_items_ - remaining_items); | 403 num_items_ - remaining_items); |
| 402 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", | 404 UMA_HISTOGRAM_MEDIUM_TIMES("Ash.WindowSelector.TimeInOverview", |
| 403 base::Time::Now() - overview_start_time_); | 405 base::Time::Now() - overview_start_time_); |
| 404 | 406 |
| 405 // Record metrics related to text filtering. | 407 // Record metrics related to text filtering. |
| 406 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", | 408 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringStringLength", |
| 407 text_filter_string_length_); | 409 text_filter_string_length_); |
| 408 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", | 410 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.TextFilteringTextfieldCleared", |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 for (size_t i = 0; i <= grid_list_.size() && | 705 for (size_t i = 0; i <= grid_list_.size() && |
| 704 grid_list_[selected_grid_index_]->Move(direction, animate); | 706 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 705 i++) { | 707 i++) { |
| 706 selected_grid_index_ = | 708 selected_grid_index_ = |
| 707 (selected_grid_index_ + display_direction + grid_list_.size()) % | 709 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 708 grid_list_.size(); | 710 grid_list_.size(); |
| 709 } | 711 } |
| 710 } | 712 } |
| 711 | 713 |
| 712 } // namespace ash | 714 } // namespace ash |
| OLD | NEW |