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

Unified Diff: ui/wm/core/nested_accelerator_dispatcher_win.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_linux.cc ('k') | ui/wm/wm.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/nested_accelerator_dispatcher_win.cc
diff --git a/ash/accelerators/accelerator_dispatcher_win.cc b/ui/wm/core/nested_accelerator_dispatcher_win.cc
similarity index 54%
rename from ash/accelerators/accelerator_dispatcher_win.cc
rename to ui/wm/core/nested_accelerator_dispatcher_win.cc
index 35005f34ad23998b3c12ff44d298bb0641a914b6..a6a5bd9d6642813f583464ad9ae917cfdfb87139 100644
--- a/ash/accelerators/accelerator_dispatcher_win.cc
+++ b/ui/wm/core/nested_accelerator_dispatcher_win.cc
@@ -2,16 +2,17 @@
// 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/message_loop/message_pump_dispatcher.h"
#include "base/run_loop.h"
#include "ui/events/event.h"
+#include "ui/wm/core/nested_accelerator_delegate.h"
using base::MessagePumpDispatcher;
-namespace ash {
+namespace wm {
namespace {
@@ -22,15 +23,16 @@ bool IsKeyEvent(const MSG& msg) {
} // namespace
-class AcceleratorDispatcherWin : public AcceleratorDispatcher,
- public MessagePumpDispatcher {
+class NestedAcceleratorDispatcherWin : public NestedAcceleratorDispatcher,
+ public MessagePumpDispatcher {
public:
- explicit AcceleratorDispatcherWin(MessagePumpDispatcher* nested)
- : nested_dispatcher_(nested) {}
- virtual ~AcceleratorDispatcherWin() {}
+ NestedAcceleratorDispatcherWin(NestedAcceleratorDelegate* delegate,
+ MessagePumpDispatcher* nested)
+ : NestedAcceleratorDispatcher(delegate), nested_dispatcher_(nested) {}
+ virtual ~NestedAcceleratorDispatcherWin() {}
private:
- // AcceleratorDispatcher:
+ // NestedAcceleratorDispatcher:
virtual scoped_ptr<base::RunLoop> CreateRunLoop() OVERRIDE {
return scoped_ptr<base::RunLoop>(new base::RunLoop(this));
}
@@ -39,10 +41,10 @@ class AcceleratorDispatcherWin : public AcceleratorDispatcher,
virtual uint32_t Dispatch(const MSG& event) OVERRIDE {
if (IsKeyEvent(event)) {
ui::KeyEvent key_event(event, false);
- if (MenuClosedForPossibleAccelerator(key_event))
+ if (!delegate_->ShouldProcessEventNow(key_event))
return POST_DISPATCH_QUIT_LOOP;
- if (AcceleratorProcessedForKeyEvent(key_event))
+ if (delegate_->ProcessEvent(key_event))
return POST_DISPATCH_NONE;
}
@@ -52,13 +54,14 @@ class AcceleratorDispatcherWin : public AcceleratorDispatcher,
MessagePumpDispatcher* nested_dispatcher_;
- DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherWin);
+ DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherWin);
};
-scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create(
+scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create(
+ NestedAcceleratorDelegate* delegate,
MessagePumpDispatcher* nested_dispatcher) {
- return scoped_ptr<AcceleratorDispatcher>(
- new AcceleratorDispatcherWin(nested_dispatcher));
+ return scoped_ptr<NestedAcceleratorDispatcher>(
+ new NestedAcceleratorDispatcherWin(delegate, nested_dispatcher));
}
-} // namespace ash
+} // namespace wm
« no previous file with comments | « ui/wm/core/nested_accelerator_dispatcher_linux.cc ('k') | ui/wm/wm.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698