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

Side by Side Diff: ui/wm/core/nested_accelerator_dispatcher_win.cc

Issue 1647933002: ash/wm: Remove dead code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « ui/wm/core/nested_accelerator_dispatcher_linux.cc ('k') | ui/wm/public/dispatcher_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/wm/core/nested_accelerator_dispatcher.h"
6
7 #include <stdint.h>
8
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_pump_dispatcher.h"
12 #include "base/run_loop.h"
13 #include "ui/base/accelerators/accelerator.h"
14 #include "ui/events/event.h"
15 #include "ui/wm/core/accelerator_filter.h"
16 #include "ui/wm/core/nested_accelerator_delegate.h"
17
18 using base::MessagePumpDispatcher;
19
20 namespace wm {
21
22 namespace {
23
24 bool IsKeyEvent(const MSG& msg) {
25 return msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN ||
26 msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP;
27 }
28
29 } // namespace
30
31 class NestedAcceleratorDispatcherWin : public NestedAcceleratorDispatcher,
32 public MessagePumpDispatcher {
33 public:
34 NestedAcceleratorDispatcherWin(NestedAcceleratorDelegate* delegate,
35 MessagePumpDispatcher* nested)
36 : NestedAcceleratorDispatcher(delegate), nested_dispatcher_(nested) {}
37 ~NestedAcceleratorDispatcherWin() override {}
38
39 private:
40 // NestedAcceleratorDispatcher:
41 scoped_ptr<base::RunLoop> CreateRunLoop() override {
42 return make_scoped_ptr(new base::RunLoop(this));
43 }
44
45 // MessagePumpDispatcher:
46 uint32_t Dispatch(const MSG& event) override {
47 if (IsKeyEvent(event)) {
48 ui::Accelerator accelerator((ui::KeyEvent(event)));
49
50 switch (delegate_->ProcessAccelerator(accelerator)) {
51 case NestedAcceleratorDelegate::RESULT_PROCESS_LATER:
52 return POST_DISPATCH_QUIT_LOOP;
53 case NestedAcceleratorDelegate::RESULT_PROCESSED:
54 return POST_DISPATCH_NONE;
55 case NestedAcceleratorDelegate::RESULT_NOT_PROCESSED:
56 break;
57 }
58 }
59
60 return nested_dispatcher_ ? nested_dispatcher_->Dispatch(event)
61 : POST_DISPATCH_PERFORM_DEFAULT;
62 }
63
64 MessagePumpDispatcher* nested_dispatcher_;
65
66 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherWin);
67 };
68
69 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create(
70 NestedAcceleratorDelegate* delegate,
71 MessagePumpDispatcher* nested_dispatcher) {
72 return make_scoped_ptr(
73 new NestedAcceleratorDispatcherWin(delegate, nested_dispatcher));
74 }
75
76 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/nested_accelerator_dispatcher_linux.cc ('k') | ui/wm/public/dispatcher_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698