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

Side by Side Diff: ui/views/focus/focus_manager.cc

Issue 2586333003: Make mash register initial batch of accelerators in single shot. (Closed)
Patch Set: Change register to use accelerator vector. Created 3 years, 12 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 &new_focus_traversable, 490 &new_focus_traversable,
491 &new_starting_view); 491 &new_starting_view);
492 } 492 }
493 return v; 493 return v;
494 } 494 }
495 495
496 void FocusManager::RegisterAccelerator( 496 void FocusManager::RegisterAccelerator(
497 const ui::Accelerator& accelerator, 497 const ui::Accelerator& accelerator,
498 ui::AcceleratorManager::HandlerPriority priority, 498 ui::AcceleratorManager::HandlerPriority priority,
499 ui::AcceleratorTarget* target) { 499 ui::AcceleratorTarget* target) {
500 accelerator_manager_->Register(accelerator, priority, target); 500 const std::vector<ui::Accelerator>& accelerators = {accelerator};
mfomitchev 2016/12/22 01:04:50 no need for a local variable.
thanhph 2016/12/22 20:36:02 Done.
501 accelerator_manager_->Register(accelerators, priority, target);
501 } 502 }
502 503
503 void FocusManager::UnregisterAccelerator(const ui::Accelerator& accelerator, 504 void FocusManager::UnregisterAccelerator(const ui::Accelerator& accelerator,
504 ui::AcceleratorTarget* target) { 505 ui::AcceleratorTarget* target) {
505 accelerator_manager_->Unregister(accelerator, target); 506 accelerator_manager_->Unregister(accelerator, target);
506 } 507 }
507 508
508 void FocusManager::UnregisterAccelerators(ui::AcceleratorTarget* target) { 509 void FocusManager::UnregisterAccelerators(ui::AcceleratorTarget* target) {
509 accelerator_manager_->UnregisterAll(target); 510 accelerator_manager_->UnregisterAll(target);
510 } 511 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 // |keyboard_accessible_| is only used on Mac. 569 // |keyboard_accessible_| is only used on Mac.
569 #if defined(OS_MACOSX) 570 #if defined(OS_MACOSX)
570 return keyboard_accessible_ ? view->IsAccessibilityFocusable() 571 return keyboard_accessible_ ? view->IsAccessibilityFocusable()
571 : view->IsFocusable(); 572 : view->IsFocusable();
572 #else 573 #else
573 return view->IsAccessibilityFocusable(); 574 return view->IsAccessibilityFocusable();
574 #endif 575 #endif
575 } 576 }
576 577
577 } // namespace views 578 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698