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

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: 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 case ui::VKEY_UP: 488 case ui::VKEY_UP:
489 num_key_presses_++; 489 num_key_presses_++;
490 Move(WindowSelector::UP, true); 490 Move(WindowSelector::UP, true);
491 break; 491 break;
492 case ui::VKEY_DOWN: 492 case ui::VKEY_DOWN:
493 num_key_presses_++; 493 num_key_presses_++;
494 Move(WindowSelector::DOWN, true); 494 Move(WindowSelector::DOWN, true);
495 break; 495 break;
496 case ui::VKEY_RIGHT: 496 case ui::VKEY_RIGHT:
497 case ui::VKEY_TAB: 497 case ui::VKEY_TAB:
498 num_key_presses_++; 498 if (!(key_event.flags() & ui::EF_SHIFT_DOWN) ||
499 Move(WindowSelector::RIGHT, true); 499 (key_event.key_code() != ui::VKEY_TAB)) {
500 break; 500 num_key_presses_++;
501 Move(WindowSelector::RIGHT, true);
502 break;
503 }
501 case ui::VKEY_LEFT: 504 case ui::VKEY_LEFT:
502 num_key_presses_++; 505 num_key_presses_++;
503 Move(WindowSelector::LEFT, true); 506 Move(WindowSelector::LEFT, true);
504 break; 507 break;
508 case ui::VKEY_W:
509 if (!(key_event.flags() & ui::EF_CONTROL_DOWN) ||
510 !grid_list_[selected_grid_index_]->is_selecting()) {
511 // allow the textfield to handle 'W' key when not used with Ctrl.
tdanderson 2016/07/07 21:26:49 nit: 'Allow' instead of 'allow'
varkha 2016/07/08 00:00:12 Done.
512 return false;
513 }
514 grid_list_[selected_grid_index_]->SelectedWindow()->CloseWindow();
tdanderson 2016/07/07 21:26:49 Either here or in a follow-up CL, consider adding
varkha 2016/07/08 00:00:12 Done.
515 break;
505 case ui::VKEY_RETURN: 516 case ui::VKEY_RETURN:
506 // Ignore if no item is selected. 517 // Ignore if no item is selected.
507 if (!grid_list_[selected_grid_index_]->is_selecting()) 518 if (!grid_list_[selected_grid_index_]->is_selecting())
508 return false; 519 return false;
509 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses", 520 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.ArrowKeyPresses",
510 num_key_presses_); 521 num_key_presses_);
511 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio", 522 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.WindowSelector.KeyPressesOverItemsRatio",
512 (num_key_presses_ * 100) / num_items_, 1, 300, 523 (num_key_presses_ * 100) / num_items_, 1, 300,
513 30); 524 30);
514 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY); 525 WmShell::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW_ENTER_KEY);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 for (size_t i = 0; i <= grid_list_.size() && 698 for (size_t i = 0; i <= grid_list_.size() &&
688 grid_list_[selected_grid_index_]->Move(direction, animate); 699 grid_list_[selected_grid_index_]->Move(direction, animate);
689 i++) { 700 i++) {
690 selected_grid_index_ = 701 selected_grid_index_ =
691 (selected_grid_index_ + display_direction + grid_list_.size()) % 702 (selected_grid_index_ + display_direction + grid_list_.size()) %
692 grid_list_.size(); 703 grid_list_.size();
693 } 704 }
694 } 705 }
695 706
696 } // namespace ash 707 } // 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