| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/accessibility_delegate.h" | 13 #include "ash/common/accessibility_delegate.h" |
| 14 #include "ash/common/accessibility_types.h" | 14 #include "ash/common/accessibility_types.h" |
| 15 #include "ash/common/metrics/user_metrics_action.h" | 15 #include "ash/common/metrics/user_metrics_action.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
| 17 #include "ash/common/wm/mru_window_tracker.h" | 17 #include "ash/common/wm/mru_window_tracker.h" |
| 18 #include "ash/common/wm/overview/window_grid.h" | 18 #include "ash/common/wm/overview/window_grid.h" |
| 19 #include "ash/common/wm/overview/window_selector_delegate.h" | 19 #include "ash/common/wm/overview/window_selector_delegate.h" |
| 20 #include "ash/common/wm/overview/window_selector_item.h" | 20 #include "ash/common/wm/overview/window_selector_item.h" |
| 21 #include "ash/common/wm/panels/panel_layout_manager.h" | 21 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 22 #include "ash/common/wm/switchable_windows.h" | 22 #include "ash/common/wm/switchable_windows.h" |
| 23 #include "ash/common/wm/window_state.h" | 23 #include "ash/common/wm/window_state.h" |
| 24 #include "ash/common/wm/wm_screen_util.h" | 24 #include "ash/common/wm/wm_screen_util.h" |
| 25 #include "ash/common/wm_lookup.h" | |
| 26 #include "ash/common/wm_shell.h" | 25 #include "ash/common/wm_shell.h" |
| 27 #include "ash/common/wm_window.h" | 26 #include "ash/common/wm_window.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 27 #include "ash/public/cpp/shell_window_ids.h" |
| 29 #include "ash/root_window_controller.h" | 28 #include "ash/root_window_controller.h" |
| 30 #include "base/auto_reset.h" | 29 #include "base/auto_reset.h" |
| 31 #include "base/command_line.h" | 30 #include "base/command_line.h" |
| 32 #include "base/metrics/histogram_macros.h" | 31 #include "base/metrics/histogram_macros.h" |
| 33 #include "third_party/skia/include/core/SkPath.h" | 32 #include "third_party/skia/include/core/SkPath.h" |
| 34 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
| 35 #include "ui/compositor/scoped_layer_animation_settings.h" | 34 #include "ui/compositor/scoped_layer_animation_settings.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 textfield->SetFontList(bundle.GetFontList(kTextFilterFontStyle)); | 189 textfield->SetFontList(bundle.GetFontList(kTextFilterFontStyle)); |
| 191 container->AddChildView(textfield); | 190 container->AddChildView(textfield); |
| 192 layout->SetFlexForView(textfield, 1); | 191 layout->SetFlexForView(textfield, 1); |
| 193 widget->SetContentsView(container); | 192 widget->SetContentsView(container); |
| 194 | 193 |
| 195 // The textfield initially contains no text, so shift its position to be | 194 // The textfield initially contains no text, so shift its position to be |
| 196 // outside the visible bounds of the screen. | 195 // outside the visible bounds of the screen. |
| 197 gfx::Transform transform; | 196 gfx::Transform transform; |
| 198 transform.Translate(0, -(*text_filter_bottom)); | 197 transform.Translate(0, -(*text_filter_bottom)); |
| 199 WmWindow* text_filter_widget_window = | 198 WmWindow* text_filter_widget_window = |
| 200 WmLookup::Get()->GetWindowForWidget(widget); | 199 WmWindow::Get(widget->GetNativeWindow()); |
| 201 text_filter_widget_window->SetOpacity(0); | 200 text_filter_widget_window->SetOpacity(0); |
| 202 text_filter_widget_window->SetTransform(transform); | 201 text_filter_widget_window->SetTransform(transform); |
| 203 widget->Show(); | 202 widget->Show(); |
| 204 textfield->RequestFocus(); | 203 textfield->RequestFocus(); |
| 205 | 204 |
| 206 return widget; | 205 return widget; |
| 207 } | 206 } |
| 208 | 207 |
| 209 } // namespace | 208 } // namespace |
| 210 | 209 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 (*iter)->FilterItems(new_contents); | 615 (*iter)->FilterItems(new_contents); |
| 617 | 616 |
| 618 // If the selection widget is not active, execute a Move() command so that it | 617 // If the selection widget is not active, execute a Move() command so that it |
| 619 // shows up on the first undimmed item. | 618 // shows up on the first undimmed item. |
| 620 if (grid_list_[selected_grid_index_]->is_selecting()) | 619 if (grid_list_[selected_grid_index_]->is_selecting()) |
| 621 return; | 620 return; |
| 622 Move(WindowSelector::RIGHT, false); | 621 Move(WindowSelector::RIGHT, false); |
| 623 } | 622 } |
| 624 | 623 |
| 625 WmWindow* WindowSelector::GetTextFilterWidgetWindow() { | 624 WmWindow* WindowSelector::GetTextFilterWidgetWindow() { |
| 626 return WmLookup::Get()->GetWindowForWidget(text_filter_widget_.get()); | 625 return WmWindow::Get(text_filter_widget_->GetNativeWindow()); |
| 627 } | 626 } |
| 628 | 627 |
| 629 void WindowSelector::PositionWindows(bool animate) { | 628 void WindowSelector::PositionWindows(bool animate) { |
| 630 for (std::unique_ptr<WindowGrid>& grid : grid_list_) | 629 for (std::unique_ptr<WindowGrid>& grid : grid_list_) |
| 631 grid->PositionWindows(animate); | 630 grid->PositionWindows(animate); |
| 632 } | 631 } |
| 633 | 632 |
| 634 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { | 633 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { |
| 635 WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); | 634 WmWindow* root_window = WmShell::Get()->GetPrimaryRootWindow(); |
| 636 const gfx::Rect rect = GetTextFilterPosition(root_window); | 635 const gfx::Rect rect = GetTextFilterPosition(root_window); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 for (size_t i = 0; i <= grid_list_.size() && | 676 for (size_t i = 0; i <= grid_list_.size() && |
| 678 grid_list_[selected_grid_index_]->Move(direction, animate); | 677 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 679 i++) { | 678 i++) { |
| 680 selected_grid_index_ = | 679 selected_grid_index_ = |
| 681 (selected_grid_index_ + display_direction + grid_list_.size()) % | 680 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 682 grid_list_.size(); | 681 grid_list_.size(); |
| 683 } | 682 } |
| 684 } | 683 } |
| 685 | 684 |
| 686 } // namespace ash | 685 } // namespace ash |
| OLD | NEW |