| 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_selector.h" | 5 #include "ash/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 static const ::ui::ResourceBundle::FontStyle kTextFilterFontStyle = | 66 static const ::ui::ResourceBundle::FontStyle kTextFilterFontStyle = |
| 67 ::ui::ResourceBundle::FontStyle::MediumFont; | 67 ::ui::ResourceBundle::FontStyle::MediumFont; |
| 68 | 68 |
| 69 // The alpha value for the background of the text filtering textbox. | 69 // The alpha value for the background of the text filtering textbox. |
| 70 const unsigned char kTextFilterOpacity = 180; | 70 const unsigned char kTextFilterOpacity = 180; |
| 71 | 71 |
| 72 // The radius used for the rounded corners on the text filtering textbox. | 72 // The radius used for the rounded corners on the text filtering textbox. |
| 73 const int kTextFilterCornerRadius = 1; | 73 const int kTextFilterCornerRadius = 1; |
| 74 | 74 |
| 75 // A comparator for locating a grid with a given root window. | 75 // A comparator for locating a grid with a given root window. |
| 76 struct RootWindowGridComparator | 76 struct RootWindowGridComparator { |
| 77 : public std::unary_function<WindowGrid*, bool> { | |
| 78 explicit RootWindowGridComparator(const aura::Window* root_window) | 77 explicit RootWindowGridComparator(const aura::Window* root_window) |
| 79 : root_window_(root_window) { | 78 : root_window_(root_window) { |
| 80 } | 79 } |
| 81 | 80 |
| 82 bool operator()(WindowGrid* grid) const { | 81 bool operator()(WindowGrid* grid) const { |
| 83 return (grid->root_window() == root_window_); | 82 return (grid->root_window() == root_window_); |
| 84 } | 83 } |
| 85 | 84 |
| 86 const aura::Window* root_window_; | 85 const aura::Window* root_window_; |
| 87 }; | 86 }; |
| 88 | 87 |
| 89 // A comparator for locating a selectable window given a targeted window. | 88 // A comparator for locating a selectable window given a targeted window. |
| 90 struct WindowSelectorItemTargetComparator | 89 struct WindowSelectorItemTargetComparator { |
| 91 : public std::unary_function<WindowSelectorItem*, bool> { | |
| 92 explicit WindowSelectorItemTargetComparator(const aura::Window* target_window) | 90 explicit WindowSelectorItemTargetComparator(const aura::Window* target_window) |
| 93 : target(target_window) { | 91 : target(target_window) { |
| 94 } | 92 } |
| 95 | 93 |
| 96 bool operator()(WindowSelectorItem* window) const { | 94 bool operator()(WindowSelectorItem* window) const { |
| 97 return window->GetWindow() == target; | 95 return window->GetWindow() == target; |
| 98 } | 96 } |
| 99 | 97 |
| 100 const aura::Window* target; | 98 const aura::Window* target; |
| 101 }; | 99 }; |
| 102 | 100 |
| 103 // A comparator for locating a selector item for a given root. | 101 // A comparator for locating a selector item for a given root. |
| 104 struct WindowSelectorItemForRoot | 102 struct WindowSelectorItemForRoot { |
| 105 : public std::unary_function<WindowSelectorItem*, bool> { | |
| 106 explicit WindowSelectorItemForRoot(const aura::Window* root) | 103 explicit WindowSelectorItemForRoot(const aura::Window* root) |
| 107 : root_window(root) { | 104 : root_window(root) { |
| 108 } | 105 } |
| 109 | 106 |
| 110 bool operator()(WindowSelectorItem* item) const { | 107 bool operator()(WindowSelectorItem* item) const { |
| 111 return item->root_window() == root_window; | 108 return item->root_window() == root_window; |
| 112 } | 109 } |
| 113 | 110 |
| 114 const aura::Window* root_window; | 111 const aura::Window* root_window; |
| 115 }; | 112 }; |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 for (size_t i = 0; | 635 for (size_t i = 0; |
| 639 i <= grid_list_.size() && | 636 i <= grid_list_.size() && |
| 640 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { | 637 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { |
| 641 selected_grid_index_ = | 638 selected_grid_index_ = |
| 642 (selected_grid_index_ + display_direction + grid_list_.size()) % | 639 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 643 grid_list_.size(); | 640 grid_list_.size(); |
| 644 } | 641 } |
| 645 } | 642 } |
| 646 | 643 |
| 647 } // namespace ash | 644 } // namespace ash |
| OLD | NEW |