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