| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 const WmWindow* root_window_; | 91 const WmWindow* root_window_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // A comparator for locating a selectable window given a targeted window. | 94 // A comparator for locating a selectable window given a targeted window. |
| 95 struct WindowSelectorItemTargetComparator { | 95 struct WindowSelectorItemTargetComparator { |
| 96 explicit WindowSelectorItemTargetComparator(const WmWindow* target_window) | 96 explicit WindowSelectorItemTargetComparator(const WmWindow* target_window) |
| 97 : target(target_window) {} | 97 : target(target_window) {} |
| 98 | 98 |
| 99 bool operator()(WindowSelectorItem* window) const { | 99 bool operator()(WindowSelectorItem* window) const { |
| 100 return window->GetWindow() == target; | 100 return window->Contains(target); |
| 101 } | 101 } |
| 102 | 102 |
| 103 const WmWindow* target; | 103 const WmWindow* target; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 // A comparator for locating a selector item for a given root. | 106 // A comparator for locating a selector item for a given root. |
| 107 struct WindowSelectorItemForRoot { | 107 struct WindowSelectorItemForRoot { |
| 108 explicit WindowSelectorItemForRoot(const WmWindow* root) | 108 explicit WindowSelectorItemForRoot(const WmWindow* root) |
| 109 : root_window(root) {} | 109 : root_window(root) {} |
| 110 | 110 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 auto grid = | 560 auto grid = |
| 561 std::find_if(grid_list_.begin(), grid_list_.end(), | 561 std::find_if(grid_list_.begin(), grid_list_.end(), |
| 562 RootWindowGridComparator(gained_active->GetRootWindow())); | 562 RootWindowGridComparator(gained_active->GetRootWindow())); |
| 563 if (grid == grid_list_.end()) | 563 if (grid == grid_list_.end()) |
| 564 return; | 564 return; |
| 565 const std::vector<WindowSelectorItem*> windows = (*grid)->window_list(); | 565 const std::vector<WindowSelectorItem*> windows = (*grid)->window_list(); |
| 566 | 566 |
| 567 auto iter = std::find_if(windows.begin(), windows.end(), | 567 auto iter = std::find_if(windows.begin(), windows.end(), |
| 568 WindowSelectorItemTargetComparator(gained_active)); | 568 WindowSelectorItemTargetComparator(gained_active)); |
| 569 | 569 |
| 570 if (iter != windows.end()) { | 570 if (iter == windows.end() && showing_text_filter_ && |
| 571 (*iter)->ShowWindowOnExit(); | 571 lost_active == GetTextFilterWidgetWindow()) { |
| 572 } else if (showing_text_filter_ && | |
| 573 lost_active == GetTextFilterWidgetWindow()) { | |
| 574 return; | 572 return; |
| 575 } | 573 } |
| 576 | 574 |
| 577 // Don't restore focus on exit if a window was just activated. | 575 // Don't restore focus on exit if a window was just activated. |
| 578 ResetFocusRestoreWindow(false); | 576 ResetFocusRestoreWindow(false); |
| 579 CancelSelection(); | 577 CancelSelection(); |
| 580 } | 578 } |
| 581 | 579 |
| 582 void WindowSelector::OnAttemptToReactivateWindow(WmWindow* request_active, | 580 void WindowSelector::OnAttemptToReactivateWindow(WmWindow* request_active, |
| 583 WmWindow* actual_active) { | 581 WmWindow* actual_active) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 for (size_t i = 0; i <= grid_list_.size() && | 674 for (size_t i = 0; i <= grid_list_.size() && |
| 677 grid_list_[selected_grid_index_]->Move(direction, animate); | 675 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 678 i++) { | 676 i++) { |
| 679 selected_grid_index_ = | 677 selected_grid_index_ = |
| 680 (selected_grid_index_ + display_direction + grid_list_.size()) % | 678 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 681 grid_list_.size(); | 679 grid_list_.size(); |
| 682 } | 680 } |
| 683 } | 681 } |
| 684 | 682 |
| 685 } // namespace ash | 683 } // namespace ash |
| OLD | NEW |