summaryrefslogtreecommitdiffstats
path: root/ash/shell.cc
diff options
context:
space:
mode:
authoryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 00:57:57 +0000
committeryusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-27 00:57:57 +0000
commit42f06f9ca2fe07018a88994569f87373a7c6c578 (patch)
tree526028affef80bcaa4a9b0771f27ac969e0b8c47 /ash/shell.cc
parent706cfde8e0b70a58ecb60d3f6eb918295b188234 (diff)
downloadchromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.zip
chromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.tar.gz
chromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.tar.bz2
Automatically remap Command key on an Apple keyboard to Control [part 1 of 2 - Ash part]
Add key_rewriter_event_filter.h which allows its delegate to rewrite or delete an aura::KeyEvent. The new interface will be used for implementing the following three features: * crosbug.com/25097: Remap keys on external keyboards (R19) * crosbug.com/27167: Consider adding a way to send function keys to web pages (R20) * crbug.com/115112: Move modifier remapping code from X to Chrome (M20) Part 2 of 2: http://codereview.chromium.org/9854025/ BUG=chromium-os:25097 BUG=chromium-os:27167 BUG=115112 TEST=try Review URL: https://chromiumcodereview.appspot.com/9838010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell.cc')
-rw-r--r--ash/shell.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/ash/shell.cc b/ash/shell.cc
index 87021be..fb24006 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -43,6 +43,7 @@
#include "ash/wm/custom_frame_view_ash.h"
#include "ash/wm/dialog_frame_view.h"
#include "ash/wm/event_client_impl.h"
+#include "ash/wm/key_rewriter_event_filter.h"
#include "ash/wm/panel_window_event_filter.h"
#include "ash/wm/panel_layout_manager.h"
#include "ash/wm/partial_screenshot_event_filter.h"
@@ -523,6 +524,7 @@ Shell::Shell(ShellDelegate* delegate)
}
Shell::~Shell() {
+ RemoveRootWindowEventFilter(key_rewriter_filter_.get());
RemoveRootWindowEventFilter(partial_screenshot_filter_.get());
RemoveRootWindowEventFilter(input_method_filter_.get());
RemoveRootWindowEventFilter(window_modality_controller_.get());
@@ -620,20 +622,24 @@ void Shell::Init() {
// Pass ownership of the filter to the root window.
GetRootWindow()->SetEventFilter(root_filter_);
+ // KeyRewriterEventFilter must be the first one.
DCHECK(!GetRootWindowEventFilterCount());
+ key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter);
+ AddRootWindowEventFilter(key_rewriter_filter_.get());
- // PartialScreenshotEventFilter must be the first one to capture key
+ // PartialScreenshotEventFilter must be the second one to capture key
// events when the taking partial screenshot UI is there.
+ DCHECK_EQ(1U, GetRootWindowEventFilterCount());
partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter);
AddRootWindowEventFilter(partial_screenshot_filter_.get());
// Then AcceleratorFilter and InputMethodEventFilter must be added (in this
// order) since they have the second highest priority.
- DCHECK_EQ(1U, GetRootWindowEventFilterCount());
+ DCHECK_EQ(2U, GetRootWindowEventFilterCount());
#if !defined(OS_MACOSX)
accelerator_filter_.reset(new internal::AcceleratorFilter);
AddRootWindowEventFilter(accelerator_filter_.get());
- DCHECK_EQ(2U, GetRootWindowEventFilterCount());
+ DCHECK_EQ(3U, GetRootWindowEventFilterCount());
#endif
input_method_filter_.reset(new internal::InputMethodEventFilter);
AddRootWindowEventFilter(input_method_filter_.get());