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 <vector> | 10 #include <vector> |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
501 void WindowSelector::OnWindowDestroying(aura::Window* window) { | 501 void WindowSelector::OnWindowDestroying(aura::Window* window) { |
502 window->RemoveObserver(this); | 502 window->RemoveObserver(this); |
503 observed_windows_.erase(window); | 503 observed_windows_.erase(window); |
504 if (window == restore_focus_window_) | 504 if (window == restore_focus_window_) |
505 restore_focus_window_ = nullptr; | 505 restore_focus_window_ = nullptr; |
506 } | 506 } |
507 | 507 |
508 void WindowSelector::OnWindowActivated(aura::Window* gained_active, | 508 void WindowSelector::OnWindowActivated( |
509 aura::Window* lost_active) { | 509 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 510 aura::Window* gained_active, |
| 511 aura::Window* lost_active) { |
510 if (ignore_activations_ || | 512 if (ignore_activations_ || |
511 !gained_active || | 513 !gained_active || |
512 gained_active == text_filter_widget_->GetNativeWindow()) { | 514 gained_active == text_filter_widget_->GetNativeWindow()) { |
513 return; | 515 return; |
514 } | 516 } |
515 | 517 |
516 ScopedVector<WindowGrid>::iterator grid = | 518 ScopedVector<WindowGrid>::iterator grid = |
517 std::find_if(grid_list_.begin(), grid_list_.end(), | 519 std::find_if(grid_list_.begin(), grid_list_.end(), |
518 RootWindowGridComparator(gained_active->GetRootWindow())); | 520 RootWindowGridComparator(gained_active->GetRootWindow())); |
519 if (grid == grid_list_.end()) | 521 if (grid == grid_list_.end()) |
520 return; | 522 return; |
521 const std::vector<WindowSelectorItem*> windows = (*grid)->window_list(); | 523 const std::vector<WindowSelectorItem*> windows = (*grid)->window_list(); |
522 | 524 |
523 ScopedVector<WindowSelectorItem>::const_iterator iter = std::find_if( | 525 ScopedVector<WindowSelectorItem>::const_iterator iter = std::find_if( |
524 windows.begin(), windows.end(), | 526 windows.begin(), windows.end(), |
525 WindowSelectorItemTargetComparator(gained_active)); | 527 WindowSelectorItemTargetComparator(gained_active)); |
526 | 528 |
527 if (iter != windows.end()) | 529 if (iter != windows.end()) |
528 (*iter)->ShowWindowOnExit(); | 530 (*iter)->ShowWindowOnExit(); |
529 | 531 |
530 // Don't restore focus on exit if a window was just activated. | 532 // Don't restore focus on exit if a window was just activated. |
531 ResetFocusRestoreWindow(false); | 533 ResetFocusRestoreWindow(false); |
532 CancelSelection(); | 534 CancelSelection(); |
533 } | 535 } |
534 | 536 |
535 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, | 537 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, |
536 aura::Window* actual_active) { | 538 aura::Window* actual_active) { |
537 OnWindowActivated(request_active, actual_active); | 539 OnWindowActivated(aura::client::ActivationChangeObserver::ActivationReason:: |
| 540 ACTIVATION_CLIENT, |
| 541 request_active, actual_active); |
538 } | 542 } |
539 | 543 |
540 void WindowSelector::ContentsChanged(views::Textfield* sender, | 544 void WindowSelector::ContentsChanged(views::Textfield* sender, |
541 const base::string16& new_contents) { | 545 const base::string16& new_contents) { |
542 text_filter_string_length_ = new_contents.length(); | 546 text_filter_string_length_ = new_contents.length(); |
543 if (!text_filter_string_length_) | 547 if (!text_filter_string_length_) |
544 num_times_textfield_cleared_++; | 548 num_times_textfield_cleared_++; |
545 | 549 |
546 bool should_show_selection_widget = !new_contents.empty(); | 550 bool should_show_selection_widget = !new_contents.empty(); |
547 if (showing_selection_widget_ != should_show_selection_widget) { | 551 if (showing_selection_widget_ != should_show_selection_widget) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 for (size_t i = 0; | 619 for (size_t i = 0; |
616 i <= grid_list_.size() && | 620 i <= grid_list_.size() && |
617 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { | 621 grid_list_[selected_grid_index_]->Move(direction, animate); i++) { |
618 selected_grid_index_ = | 622 selected_grid_index_ = |
619 (selected_grid_index_ + display_direction + grid_list_.size()) % | 623 (selected_grid_index_ + display_direction + grid_list_.size()) % |
620 grid_list_.size(); | 624 grid_list_.size(); |
621 } | 625 } |
622 } | 626 } |
623 | 627 |
624 } // namespace ash | 628 } // namespace ash |
OLD | NEW |