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

Unified Diff: ui/wm/core/nested_accelerator_dispatcher_linux.cc

Issue 298703007: Refactor and move ash independent nested accelerator code to ui/wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip test if platform does not support PES Created 6 years, 7 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 | « ui/wm/core/nested_accelerator_dispatcher.cc ('k') | ui/wm/core/nested_accelerator_dispatcher_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/nested_accelerator_dispatcher_linux.cc
diff --git a/ash/accelerators/accelerator_dispatcher_linux.cc b/ui/wm/core/nested_accelerator_dispatcher_linux.cc
similarity index 70%
rename from ash/accelerators/accelerator_dispatcher_linux.cc
rename to ui/wm/core/nested_accelerator_dispatcher_linux.cc
index b5494dd2e129f32fa18db2c035b2f145aad8c6ff..bf21d3f9ff5a3931ef9ab15ff87990d06cd3b05f 100644
--- a/ash/accelerators/accelerator_dispatcher_linux.cc
+++ b/ui/wm/core/nested_accelerator_dispatcher_linux.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/accelerators/accelerator_dispatcher.h"
+#include "ui/wm/core/nested_accelerator_dispatcher.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
@@ -10,12 +10,13 @@
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/scoped_event_dispatcher.h"
+#include "ui/wm/core/nested_accelerator_delegate.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
#endif
-namespace ash {
+namespace wm {
namespace {
@@ -41,13 +42,14 @@ scoped_ptr<ui::ScopedEventDispatcher> OverrideDispatcher(
} // namespace
-class AcceleratorDispatcherLinux : public AcceleratorDispatcher,
- public ui::PlatformEventDispatcher {
+class NestedAcceleratorDispatcherLinux : public NestedAcceleratorDispatcher,
+ public ui::PlatformEventDispatcher {
public:
- AcceleratorDispatcherLinux()
- : restore_dispatcher_(OverrideDispatcher(this)) {}
+ explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate)
+ : NestedAcceleratorDispatcher(delegate),
+ restore_dispatcher_(OverrideDispatcher(this)) {}
- virtual ~AcceleratorDispatcherLinux() {}
+ virtual ~NestedAcceleratorDispatcherLinux() {}
private:
// AcceleratorDispatcher:
@@ -63,7 +65,7 @@ class AcceleratorDispatcherLinux : public AcceleratorDispatcher,
virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE {
if (IsKeyEvent(event)) {
ui::KeyEvent key_event(event, false);
- if (MenuClosedForPossibleAccelerator(key_event)) {
+ if (!delegate_->ShouldProcessEventNow(key_event)) {
#if defined(USE_X11)
XPutBackEvent(event->xany.display, event);
#else
@@ -72,23 +74,25 @@ class AcceleratorDispatcherLinux : public AcceleratorDispatcher,
return ui::POST_DISPATCH_NONE;
}
- if (AcceleratorProcessedForKeyEvent(key_event))
+ if (delegate_->ProcessEvent(key_event))
return ui::POST_DISPATCH_NONE;
}
-
ui::PlatformEventDispatcher* prev = *restore_dispatcher_;
+
return prev ? prev->DispatchEvent(event)
: ui::POST_DISPATCH_PERFORM_DEFAULT;
}
scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_;
- DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherLinux);
+ DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux);
};
-scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create(
+scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create(
+ NestedAcceleratorDelegate* delegate,
base::MessagePumpDispatcher* nested_dispatcher) {
- return scoped_ptr<AcceleratorDispatcher>(new AcceleratorDispatcherLinux());
+ return scoped_ptr<NestedAcceleratorDispatcher>(
+ new NestedAcceleratorDispatcherLinux(delegate));
}
-} // namespace ash
+} // namespace wm
« no previous file with comments | « ui/wm/core/nested_accelerator_dispatcher.cc ('k') | ui/wm/core/nested_accelerator_dispatcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698