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

Unified Diff: ash/shell.cc

Issue 9838010: Automatically remap Command key on an Apple keyboard to Control [part 1 of 2 - Ash part] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 8 years, 9 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
« no previous file with comments | « ash/shell.h ('k') | ash/wm/key_rewriter_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index 4c3282b86de396ae4b5f695bc12145bce443bfbe..6bdf0cb0059cf1cc9cf985289b7c0c5a3aad10b9 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());
« no previous file with comments | « ash/shell.h ('k') | ash/wm/key_rewriter_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698