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

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

Issue 2131603004: [ash-md] Makes Ctrl+W accelerator close a selected window in overview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Makes Ctrl+W accelerator close a selected window in overview mode (rebase) Created 4 years, 5 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 | « no previous file | ash/common/wm/overview/window_selector_item.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/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>
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 case ui::VKEY_UP: 492 case ui::VKEY_UP:
493 num_key_presses_++; 493 num_key_presses_++;
494 Move(WindowSelector::UP, true); 494 Move(WindowSelector::UP, true);
495 break; 495 break;
496 case ui::VKEY_DOWN: 496 case ui::VKEY_DOWN:
497 num_key_presses_++; 497 num_key_presses_++;
498 Move(WindowSelector::DOWN, true); 498 Move(WindowSelector::DOWN, true);
499 break; 499 break;
500 case ui::VKEY_RIGHT: 500 case ui::VKEY_RIGHT:
501 case ui::VKEY_TAB: 501 case ui::VKEY_TAB:
502 num_key_presses_++; 502 if (!(key_event.flags() & ui::EF_SHIFT_DOWN) ||
503 Move(WindowSelector::RIGHT, true); 503 (key_event.key_code() != ui::VKEY_TAB)) {
tdanderson 2016/07/07 21:26:49 nit: I think this is slightly more readable: if (k
varkha 2016/07/08 00:00:13 Done.
504 break; 504 num_key_presses_++;
505 Move(WindowSelector::RIGHT, true);
506 break;
507 }
505 case ui::VKEY_LEFT: 508 case ui::VKEY_LEFT:
506 num_key_presses_++; 509 num_key_presses_++;
507 Move(WindowSelector::LEFT, true); 510 Move(WindowSelector::LEFT, true);
508 break; 511 break;
512 case ui::VKEY_W:
513 if (!(key_event.flags() & ui::EF_CONTROL_DOWN) ||
514 !grid_list_[selected_grid_index_]->is_selecting()) {
515 // allow the textfield to handle 'W' key when not used with Ctrl.
516 return false;
517 }
518 grid_list_[selected_grid_index_]->SelectedWindow()->CloseWindow();
519 break;
509 case ui::VKEY_RETURN: 520 case ui::VKEY_RETURN:
510 // Ignore if no item is selected. 521 // Ignore if no item is selected.
511 if (!grid_list_[selected_grid_index_]->is_selecting()) 522 if (!grid_list_[selected_grid_index_]->is_selecting())
512 return false; 523 return false;
513 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses", 524 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses",
514 num_key_presses_); 525 num_key_presses_);
515 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio", 526 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio",
516 (num_key_presses_ * 100) / num_items_, 1, 300, 527 (num_key_presses_ * 100) / num_items_, 1, 300,
517 30); 528 30);
518 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY); 529 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 for (size_t i = 0; i <= grid_list_.size() && 702 for (size_t i = 0; i <= grid_list_.size() &&
692 grid_list_[selected_grid_index_]->Move(direction, animate); 703 grid_list_[selected_grid_index_]->Move(direction, animate);
693 i++) { 704 i++) {
694 selected_grid_index_ = 705 selected_grid_index_ =
695 (selected_grid_index_ + display_direction + grid_list_.size()) % 706 (selected_grid_index_ + display_direction + grid_list_.size()) %
696 grid_list_.size(); 707 grid_list_.size();
697 } 708 }
698 } 709 }
699 710
700 } // namespace ash 711 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698