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

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

Issue 224023: Don't send tab switching/killing/creating keyboard accelerators to pages. Th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: call Browser:IsReservedAccelerator from tab_contents_view.cc instead of each platform file Created 11 years, 3 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/views/frame/browser_view.cc
===================================================================
--- chrome/browser/views/frame/browser_view.cc (revision 27783)
+++ chrome/browser/views/frame/browser_view.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/keyboard_codes.h"
#include "base/time.h"
+#include "base/win_util.h"
#include "build/build_config.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/app_modal_dialog_queue.h"
@@ -48,6 +49,7 @@
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/window_sizer.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/native_web_keyboard_event.h"
#include "chrome/common/native_window_notification_source.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -1127,6 +1129,24 @@
toolbar_->app_menu()->Activate();
}
+int BrowserView::GetCommandId(const NativeWebKeyboardEvent& event) {
+ views::Accelerator accelerator(
+ win_util::WinToKeyboardCode(event.windowsKeyCode),
+ (event.modifiers & NativeWebKeyboardEvent::ShiftKey) ==
+ NativeWebKeyboardEvent::ShiftKey,
+ (event.modifiers & NativeWebKeyboardEvent::ControlKey) ==
+ NativeWebKeyboardEvent::ControlKey,
+ (event.modifiers & NativeWebKeyboardEvent::AltKey) ==
+ NativeWebKeyboardEvent::AltKey);
+
+ std::map<views::Accelerator, int>::const_iterator iter =
+ accelerator_table_.find(accelerator);
+ if (iter == accelerator_table_.end())
+ return -1;
+
+ return iter->second;
+}
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindowTesting implementation:

Powered by Google App Engine
This is Rietveld 408576698