| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/accessibility_delegate.h" | 13 #include "ash/accessibility_delegate.h" |
| 14 #include "ash/accessibility_types.h" | 14 #include "ash/accessibility_types.h" |
| 15 #include "ash/metrics/user_metrics_action.h" | 15 #include "ash/metrics/user_metrics_action.h" |
| 16 #include "ash/public/cpp/shell_window_ids.h" | 16 #include "ash/public/cpp/shell_window_ids.h" |
| 17 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 18 #include "ash/screen_util.h" | 18 #include "ash/screen_util.h" |
| 19 #include "ash/shelf/shelf.h" | 19 #include "ash/shelf/shelf.h" |
| 20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/shell_port.h" | 21 #include "ash/shell_port.h" |
| 22 #include "ash/wm/mru_window_tracker.h" | 22 #include "ash/wm/mru_window_tracker.h" |
| 23 #include "ash/wm/overview/overview_window_drag_controller.h" |
| 23 #include "ash/wm/overview/window_grid.h" | 24 #include "ash/wm/overview/window_grid.h" |
| 24 #include "ash/wm/overview/window_selector_delegate.h" | 25 #include "ash/wm/overview/window_selector_delegate.h" |
| 25 #include "ash/wm/overview/window_selector_item.h" | 26 #include "ash/wm/overview/window_selector_item.h" |
| 26 #include "ash/wm/panels/panel_layout_manager.h" | 27 #include "ash/wm/panels/panel_layout_manager.h" |
| 28 #include "ash/wm/splitview/split_view_controller.h" |
| 27 #include "ash/wm/switchable_windows.h" | 29 #include "ash/wm/switchable_windows.h" |
| 28 #include "ash/wm/window_state.h" | 30 #include "ash/wm/window_state.h" |
| 29 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
| 30 #include "base/auto_reset.h" | 32 #include "base/auto_reset.h" |
| 31 #include "base/command_line.h" | 33 #include "base/command_line.h" |
| 32 #include "base/metrics/histogram_macros.h" | 34 #include "base/metrics/histogram_macros.h" |
| 33 #include "third_party/skia/include/core/SkPath.h" | 35 #include "third_party/skia/include/core/SkPath.h" |
| 34 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
| 35 #include "ui/compositor/layer.h" | 37 #include "ui/compositor/layer.h" |
| 36 #include "ui/compositor/scoped_layer_animation_settings.h" | 38 #include "ui/compositor/scoped_layer_animation_settings.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 133 |
| 132 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); | 134 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 // Triggers a shelf visibility update on all root window controllers. | 137 // Triggers a shelf visibility update on all root window controllers. |
| 136 void UpdateShelfVisibility() { | 138 void UpdateShelfVisibility() { |
| 137 for (aura::Window* root : Shell::GetAllRootWindows()) | 139 for (aura::Window* root : Shell::GetAllRootWindows()) |
| 138 Shelf::ForWindow(root)->UpdateVisibilityState(); | 140 Shelf::ForWindow(root)->UpdateVisibilityState(); |
| 139 } | 141 } |
| 140 | 142 |
| 143 // Returns the bounds for the overview window grids according to the split view |
| 144 // state. |
| 145 gfx::Rect GetGridsBoundsInScreen(aura::Window* root_window) { |
| 146 if (Shell::Get()->IsSplitViewModeActive()) { |
| 147 return Shell::Get() |
| 148 ->split_view_controller() |
| 149 ->GetSnappedWindowBoundsInScreen( |
| 150 root_window, Shell::Get()->split_view_controller()->state()); |
| 151 } else { |
| 152 return Shell::Get() |
| 153 ->split_view_controller() |
| 154 ->GetDisplayWorkAreaBoundsInScreen(root_window); |
| 155 } |
| 156 } |
| 157 |
| 141 gfx::Rect GetTextFilterPosition(aura::Window* root_window) { | 158 gfx::Rect GetTextFilterPosition(aura::Window* root_window) { |
| 142 gfx::Rect total_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 159 gfx::Rect total_bounds = GetGridsBoundsInScreen(root_window); |
| 143 root_window->GetChildById(kShellWindowId_DefaultContainer)); | |
| 144 ::wm::ConvertRectToScreen(root_window, &total_bounds); | |
| 145 return gfx::Rect( | 160 return gfx::Rect( |
| 146 0.5 * (total_bounds.width() - | 161 0.5 * (total_bounds.width() - |
| 147 std::min(kTextFilterWidth, total_bounds.width())), | 162 std::min(kTextFilterWidth, total_bounds.width())) + |
| 163 total_bounds.x(), |
| 148 total_bounds.y() + total_bounds.height() * kTextFilterTopScreenProportion, | 164 total_bounds.y() + total_bounds.height() * kTextFilterTopScreenProportion, |
| 149 std::min(kTextFilterWidth, total_bounds.width()), kTextFilterHeight); | 165 std::min(kTextFilterWidth, total_bounds.width()), kTextFilterHeight); |
| 150 } | 166 } |
| 151 | 167 |
| 152 // Initializes the text filter on the top of the main root window and requests | 168 // Initializes the text filter on the top of the main root window and requests |
| 153 // focus on its textfield. Uses |image| to place an icon to the left of the text | 169 // focus on its textfield. Uses |image| to place an icon to the left of the text |
| 154 // field. | 170 // field. |
| 155 views::Widget* CreateTextFilter(views::TextfieldController* controller, | 171 views::Widget* CreateTextFilter(views::TextfieldController* controller, |
| 156 aura::Window* root_window, | 172 aura::Window* root_window, |
| 157 const gfx::ImageSkia& image, | 173 const gfx::ImageSkia& image, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 aura::Window* container = | 280 aura::Window* container = |
| 265 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); | 281 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); |
| 266 container->AddObserver(this); | 282 container->AddObserver(this); |
| 267 observed_windows_.insert(container); | 283 observed_windows_.insert(container); |
| 268 } | 284 } |
| 269 | 285 |
| 270 // Hide the callout widgets for panels. It is safe to call this for | 286 // Hide the callout widgets for panels. It is safe to call this for |
| 271 // root windows that don't contain any panel windows. | 287 // root windows that don't contain any panel windows. |
| 272 PanelLayoutManager::Get(root)->SetShowCalloutWidgets(false); | 288 PanelLayoutManager::Get(root)->SetShowCalloutWidgets(false); |
| 273 | 289 |
| 274 std::unique_ptr<WindowGrid> grid(new WindowGrid(root, windows, this)); | 290 std::unique_ptr<WindowGrid> grid( |
| 291 new WindowGrid(root, windows, this, GetGridsBoundsInScreen(root))); |
| 275 if (grid->empty()) | 292 if (grid->empty()) |
| 276 continue; | 293 continue; |
| 277 num_items_ += grid->size(); | 294 num_items_ += grid->size(); |
| 278 grid_list_.push_back(std::move(grid)); | 295 grid_list_.push_back(std::move(grid)); |
| 279 } | 296 } |
| 280 | 297 |
| 281 { | 298 { |
| 282 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) | 299 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) |
| 283 // requires some LayoutManagers (ie PanelLayoutManager) to perform layouts | 300 // requires some LayoutManagers (ie PanelLayoutManager) to perform layouts |
| 284 // so that windows are correctly visible and properly animated in overview | 301 // so that windows are correctly visible and properly animated in overview |
| (...skipping 16 matching lines...) Expand all Loading... |
| 301 kTextFilterIconColor); | 318 kTextFilterIconColor); |
| 302 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 319 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 303 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, | 320 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, |
| 304 &text_filter_bottom_)); | 321 &text_filter_bottom_)); |
| 305 } | 322 } |
| 306 | 323 |
| 307 DCHECK(!grid_list_.empty()); | 324 DCHECK(!grid_list_.empty()); |
| 308 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); | 325 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); |
| 309 | 326 |
| 310 Shell::Get()->activation_client()->AddObserver(this); | 327 Shell::Get()->activation_client()->AddObserver(this); |
| 328 Shell::Get()->split_view_controller()->AddObserver(this); |
| 311 | 329 |
| 312 display::Screen::GetScreen()->AddObserver(this); | 330 display::Screen::GetScreen()->AddObserver(this); |
| 313 ShellPort::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); | 331 ShellPort::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
| 314 // Send an a11y alert. | 332 // Send an a11y alert. |
| 315 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | 333 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( |
| 316 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); | 334 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); |
| 317 | 335 |
| 318 UpdateShelfVisibility(); | 336 UpdateShelfVisibility(); |
| 319 } | 337 } |
| 320 | 338 |
| 321 // NOTE: The work done in Shutdown() is not done in the destructor because it | 339 // NOTE: The work done in Shutdown() is not done in the destructor because it |
| 322 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect | 340 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect |
| 323 // calls to restoring_minimized_windows() on a partially destructed object. | 341 // calls to restoring_minimized_windows() on a partially destructed object. |
| 324 void WindowSelector::Shutdown() { | 342 void WindowSelector::Shutdown() { |
| 325 is_shut_down_ = true; | 343 is_shut_down_ = true; |
| 326 // Stop observing screen metrics changes first to avoid auto-positioning | 344 // Stop observing screen metrics changes first to avoid auto-positioning |
| 327 // windows in response to work area changes from window activation. | 345 // windows in response to work area changes from window activation. |
| 328 display::Screen::GetScreen()->RemoveObserver(this); | 346 display::Screen::GetScreen()->RemoveObserver(this); |
| 329 | 347 |
| 348 // Stop observing split view state changes before restoring window focus. |
| 349 // Otherwise the activation of the window triggers OnSplitViewStateChanged() |
| 350 // that will call into this function again. |
| 351 Shell::Get()->split_view_controller()->RemoveObserver(this); |
| 352 |
| 330 size_t remaining_items = 0; | 353 size_t remaining_items = 0; |
| 331 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 354 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
| 332 for (const auto& window_selector_item : window_grid->window_list()) | 355 for (const auto& window_selector_item : window_grid->window_list()) |
| 333 window_selector_item->RestoreWindow(); | 356 window_selector_item->RestoreWindow(); |
| 334 remaining_items += window_grid->size(); | 357 remaining_items += window_grid->size(); |
| 335 } | 358 } |
| 336 | 359 |
| 337 // Setting focus after restoring windows' state avoids unnecessary animations. | 360 // Setting focus after restoring windows' state avoids unnecessary animations. |
| 338 ResetFocusRestoreWindow(true); | 361 ResetFocusRestoreWindow(true); |
| 339 RemoveAllObservers(); | 362 RemoveAllObservers(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } | 462 } |
| 440 } | 463 } |
| 441 item->EnsureVisible(); | 464 item->EnsureVisible(); |
| 442 wm::GetWindowState(window)->Activate(); | 465 wm::GetWindowState(window)->Activate(); |
| 443 } | 466 } |
| 444 | 467 |
| 445 void WindowSelector::WindowClosing(WindowSelectorItem* window) { | 468 void WindowSelector::WindowClosing(WindowSelectorItem* window) { |
| 446 grid_list_[selected_grid_index_]->WindowClosing(window); | 469 grid_list_[selected_grid_index_]->WindowClosing(window); |
| 447 } | 470 } |
| 448 | 471 |
| 472 void WindowSelector::SetBoundsForWindowGridsInScreen(const gfx::Rect bounds) { |
| 473 for (std::unique_ptr<WindowGrid>& grid : grid_list_) |
| 474 grid->SetTotalBoundsInScreen(bounds); |
| 475 } |
| 476 |
| 477 void WindowSelector::RemoveWindowSelectorItem(WindowSelectorItem* item) { |
| 478 if (item->GetWindow()->HasObserver(this)) { |
| 479 item->GetWindow()->RemoveObserver(this); |
| 480 observed_windows_.erase(item->GetWindow()); |
| 481 if (item->GetWindow() == restore_focus_window_) |
| 482 restore_focus_window_ = nullptr; |
| 483 } |
| 484 |
| 485 // Remove |item| from the corresponding grid. |
| 486 for (std::unique_ptr<WindowGrid>& grid : grid_list_) { |
| 487 if (grid->Contains(item->GetWindow())) { |
| 488 grid->RemoveItem(item); |
| 489 break; |
| 490 } |
| 491 } |
| 492 } |
| 493 |
| 494 void WindowSelector::InitiateDrag(WindowSelectorItem* item, |
| 495 const gfx::Point& location_in_screen) { |
| 496 window_drag_controller_.reset(new OverviewWindowDragController(this)); |
| 497 window_drag_controller_->InitiateDrag(item, location_in_screen); |
| 498 } |
| 499 |
| 500 void WindowSelector::Drag(WindowSelectorItem* item, |
| 501 const gfx::Point& location_in_screen) { |
| 502 DCHECK(window_drag_controller_.get()); |
| 503 window_drag_controller_->Drag(item, location_in_screen); |
| 504 } |
| 505 |
| 506 void WindowSelector::CompleteDrag(WindowSelectorItem* item) { |
| 507 DCHECK(window_drag_controller_.get()); |
| 508 window_drag_controller_->CompleteDrag(item); |
| 509 } |
| 510 |
| 449 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, | 511 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, |
| 450 const ui::KeyEvent& key_event) { | 512 const ui::KeyEvent& key_event) { |
| 451 if (key_event.type() != ui::ET_KEY_PRESSED) | 513 if (key_event.type() != ui::ET_KEY_PRESSED) |
| 452 return false; | 514 return false; |
| 453 | 515 |
| 454 switch (key_event.key_code()) { | 516 switch (key_event.key_code()) { |
| 455 case ui::VKEY_ESCAPE: | 517 case ui::VKEY_ESCAPE: |
| 456 CancelSelection(); | 518 CancelSelection(); |
| 457 break; | 519 break; |
| 458 case ui::VKEY_UP: | 520 case ui::VKEY_UP: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 567 |
| 506 void WindowSelector::OnDisplayAdded(const display::Display& display) {} | 568 void WindowSelector::OnDisplayAdded(const display::Display& display) {} |
| 507 | 569 |
| 508 void WindowSelector::OnDisplayRemoved(const display::Display& display) { | 570 void WindowSelector::OnDisplayRemoved(const display::Display& display) { |
| 509 // TODO(flackr): Keep window selection active on remaining displays. | 571 // TODO(flackr): Keep window selection active on remaining displays. |
| 510 CancelSelection(); | 572 CancelSelection(); |
| 511 } | 573 } |
| 512 | 574 |
| 513 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, | 575 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, |
| 514 uint32_t metrics) { | 576 uint32_t metrics) { |
| 577 // Re-calculate the bounds for the window grids and position all the windows. |
| 578 for (std::unique_ptr<WindowGrid>& grid : grid_list_) { |
| 579 SetBoundsForWindowGridsInScreen( |
| 580 GetGridsBoundsInScreen(const_cast<aura::Window*>(grid->root_window()))); |
| 581 } |
| 515 PositionWindows(/* animate */ false); | 582 PositionWindows(/* animate */ false); |
| 516 RepositionTextFilterOnDisplayMetricsChange(); | 583 RepositionTextFilterOnDisplayMetricsChange(); |
| 517 } | 584 } |
| 518 | 585 |
| 519 void WindowSelector::OnWindowHierarchyChanged( | 586 void WindowSelector::OnWindowHierarchyChanged( |
| 520 const HierarchyChangeParams& params) { | 587 const HierarchyChangeParams& params) { |
| 521 // Only care about newly added children of |observed_windows_|. | 588 // Only care about newly added children of |observed_windows_|. |
| 522 if (!observed_windows_.count(params.receiver) || | 589 if (!observed_windows_.count(params.receiver) || |
| 523 !observed_windows_.count(params.new_parent)) { | 590 !observed_windows_.count(params.new_parent)) { |
| 524 return; | 591 return; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 windows.begin(), windows.end(), | 634 windows.begin(), windows.end(), |
| 568 [gained_active](const std::unique_ptr<WindowSelectorItem>& window) { | 635 [gained_active](const std::unique_ptr<WindowSelectorItem>& window) { |
| 569 return window->Contains(gained_active); | 636 return window->Contains(gained_active); |
| 570 }); | 637 }); |
| 571 | 638 |
| 572 if (iter == windows.end() && showing_text_filter_ && | 639 if (iter == windows.end() && showing_text_filter_ && |
| 573 lost_active == GetTextFilterWidgetWindow()) { | 640 lost_active == GetTextFilterWidgetWindow()) { |
| 574 return; | 641 return; |
| 575 } | 642 } |
| 576 | 643 |
| 644 // Do not cancel the overview mode if the window activation was caused by |
| 645 // snapping window to one side of the screen. |
| 646 if (Shell::Get()->IsSplitViewModeActive()) |
| 647 return; |
| 648 |
| 577 // Don't restore focus on exit if a window was just activated. | 649 // Don't restore focus on exit if a window was just activated. |
| 578 ResetFocusRestoreWindow(false); | 650 ResetFocusRestoreWindow(false); |
| 579 CancelSelection(); | 651 CancelSelection(); |
| 580 } | 652 } |
| 581 | 653 |
| 582 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, | 654 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, |
| 583 aura::Window* actual_active) { | 655 aura::Window* actual_active) { |
| 584 OnWindowActivated(ActivationReason::ACTIVATION_CLIENT, request_active, | 656 OnWindowActivated(ActivationReason::ACTIVATION_CLIENT, request_active, |
| 585 actual_active); | 657 actual_active); |
| 586 } | 658 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 617 for (auto iter = grid_list_.begin(); iter != grid_list_.end(); iter++) | 689 for (auto iter = grid_list_.begin(); iter != grid_list_.end(); iter++) |
| 618 (*iter)->FilterItems(new_contents); | 690 (*iter)->FilterItems(new_contents); |
| 619 | 691 |
| 620 // If the selection widget is not active, execute a Move() command so that it | 692 // If the selection widget is not active, execute a Move() command so that it |
| 621 // shows up on the first undimmed item. | 693 // shows up on the first undimmed item. |
| 622 if (grid_list_[selected_grid_index_]->is_selecting()) | 694 if (grid_list_[selected_grid_index_]->is_selecting()) |
| 623 return; | 695 return; |
| 624 Move(WindowSelector::RIGHT, false); | 696 Move(WindowSelector::RIGHT, false); |
| 625 } | 697 } |
| 626 | 698 |
| 627 aura::Window* WindowSelector::GetTextFilterWidgetWindow() { | 699 void WindowSelector::OnSplitViewStateChanged( |
| 628 return text_filter_widget_->GetNativeWindow(); | 700 SplitViewController::State previous_state, |
| 701 SplitViewController::State state) { |
| 702 if (state != SplitViewController::NOSNAP) { |
| 703 // Do not restore focus if a window was just snapped and activated. |
| 704 ResetFocusRestoreWindow(false); |
| 705 } |
| 706 |
| 707 if (state == SplitViewController::LEFT_SNAPPED) { |
| 708 aura::Window* snapped_window = |
| 709 Shell::Get()->split_view_controller()->left_window(); |
| 710 const gfx::Rect bounds_in_screen = |
| 711 Shell::Get()->split_view_controller()->GetSnappedWindowBoundsInScreen( |
| 712 snapped_window, SplitViewController::RIGHT_SNAPPED); |
| 713 SetBoundsForWindowGridsInScreen(bounds_in_screen); |
| 714 } else if (state == SplitViewController::RIGHT_SNAPPED) { |
| 715 aura::Window* snapped_window = |
| 716 Shell::Get()->split_view_controller()->right_window(); |
| 717 const gfx::Rect bounds_in_screen = |
| 718 Shell::Get()->split_view_controller()->GetSnappedWindowBoundsInScreen( |
| 719 snapped_window, SplitViewController::LEFT_SNAPPED); |
| 720 SetBoundsForWindowGridsInScreen(bounds_in_screen); |
| 721 } else if (state == SplitViewController::BOTH_SNAPPED) { |
| 722 CancelSelection(); |
| 723 } else { |
| 724 DCHECK(state == SplitViewController::BOTH_SNAPPED || |
| 725 state == SplitViewController::NOSNAP); |
| 726 // If two windows were snapped to both sides of the screen, end overview |
| 727 // mode. If split view mode was ended (e.g., one of the snapped window was |
| 728 // closed or minimized / fullscreened / maximized), also end overview mode |
| 729 // if overview mode is active. |
| 730 CancelSelection(); |
| 731 } |
| 629 } | 732 } |
| 630 | 733 |
| 631 void WindowSelector::PositionWindows(bool animate) { | 734 void WindowSelector::PositionWindows(bool animate) { |
| 632 for (std::unique_ptr<WindowGrid>& grid : grid_list_) | 735 for (std::unique_ptr<WindowGrid>& grid : grid_list_) |
| 633 grid->PositionWindows(animate); | 736 grid->PositionWindows(animate); |
| 634 } | 737 } |
| 635 | 738 |
| 739 aura::Window* WindowSelector::GetTextFilterWidgetWindow() { |
| 740 return text_filter_widget_->GetNativeWindow(); |
| 741 } |
| 742 |
| 636 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { | 743 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { |
| 637 const gfx::Rect rect = GetTextFilterPosition(Shell::GetPrimaryRootWindow()); | 744 const gfx::Rect rect = GetTextFilterPosition(Shell::GetPrimaryRootWindow()); |
| 638 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; | 745 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; |
| 639 text_filter_widget_->SetBounds(rect); | 746 text_filter_widget_->SetBounds(rect); |
| 640 | 747 |
| 641 gfx::Transform transform; | 748 gfx::Transform transform; |
| 642 transform.Translate( | 749 transform.Translate( |
| 643 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); | 750 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); |
| 644 aura::Window* text_filter_window = GetTextFilterWidgetWindow(); | 751 aura::Window* text_filter_window = GetTextFilterWidgetWindow(); |
| 645 text_filter_window->layer()->SetOpacity(text_filter_string_length_ == 0 ? 0 | 752 text_filter_window->layer()->SetOpacity(text_filter_string_length_ == 0 ? 0 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 for (size_t i = 0; i <= grid_list_.size() && | 786 for (size_t i = 0; i <= grid_list_.size() && |
| 680 grid_list_[selected_grid_index_]->Move(direction, animate); | 787 grid_list_[selected_grid_index_]->Move(direction, animate); |
| 681 i++) { | 788 i++) { |
| 682 selected_grid_index_ = | 789 selected_grid_index_ = |
| 683 (selected_grid_index_ + display_direction + grid_list_.size()) % | 790 (selected_grid_index_ + display_direction + grid_list_.size()) % |
| 684 grid_list_.size(); | 791 grid_list_.size(); |
| 685 } | 792 } |
| 686 } | 793 } |
| 687 | 794 |
| 688 } // namespace ash | 795 } // namespace ash |
| OLD | NEW |