Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: ash/wm/overview/window_selector.cc

Issue 1151133003: Added an ActivationReason parameter to ActivationChangeObserver::OnWindowActivated(...). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uploaded diff based on dependant CL. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/overview/window_selector.h ('k') | ash/wm/panels/panel_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector.h ('k') | ash/wm/panels/panel_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698