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

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2128243003: Make most browser accelerators not repeat. (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 5339809471f2b05aeb33fb80c0354ed45c98710c..1cdeb05026fec0b4de41d8cfb80c8ef9d1862e94 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -2009,6 +2009,9 @@ bool BrowserView::AcceleratorPressed(const ui::Accelerator& accelerator) {
DCHECK(iter != accelerator_table_.end());
int command_id = iter->second;
+ if (accelerator.IsRepeat() && !repeatable_command_ids_.count(command_id))
+ return false;
+
chrome::BrowserCommandController* controller = browser_->command_controller();
if (!controller->block_command_execution())
UpdateAcceleratorMetrics(accelerator, command_id);
@@ -2398,6 +2401,10 @@ void BrowserView::LoadAccelerators() {
focus_manager->RegisterAccelerator(
accelerator, ui::AcceleratorManager::kNormalPriority, this);
}
+
+ const std::vector<int> command_ids(chrome::GetRepeatableCommandIds());
+ repeatable_command_ids_ =
+ std::set<int>(command_ids.begin(), command_ids.end());
}
int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const {

Powered by Google App Engine
This is Rietveld 408576698