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

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

Issue 666673005: Explicitly coerce PostDispatchAction to uint32_t in DispatchEvent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui_enums
Patch Set: sigh. Windows. Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/wm/core/nested_accelerator_dispatcher.h" 5 #include "ui/wm/core/nested_accelerator_dispatcher.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "ui/base/accelerators/accelerator.h" 9 #include "ui/base/accelerators/accelerator.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // AcceleratorDispatcher: 57 // AcceleratorDispatcher:
58 virtual scoped_ptr<base::RunLoop> CreateRunLoop() override { 58 virtual scoped_ptr<base::RunLoop> CreateRunLoop() override {
59 return scoped_ptr<base::RunLoop>(new base::RunLoop()); 59 return scoped_ptr<base::RunLoop>(new base::RunLoop());
60 } 60 }
61 61
62 // ui::PlatformEventDispatcher: 62 // ui::PlatformEventDispatcher:
63 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { 63 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override {
64 return true; 64 return true;
65 } 65 }
66 66
67 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { 67 virtual ui::PostDispatchAction DispatchEvent(
68 const ui::PlatformEvent& event) override {
68 if (IsKeyEvent(event)) { 69 if (IsKeyEvent(event)) {
69 ui::KeyEvent key_event(event); 70 ui::KeyEvent key_event(event);
70 ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event); 71 ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event);
71 72
72 switch (delegate_->ProcessAccelerator(accelerator)) { 73 switch (delegate_->ProcessAccelerator(accelerator)) {
73 case NestedAcceleratorDelegate::RESULT_PROCESS_LATER: 74 case NestedAcceleratorDelegate::RESULT_PROCESS_LATER:
74 #if defined(USE_X11) 75 #if defined(USE_X11)
75 XPutBackEvent(event->xany.display, event); 76 XPutBackEvent(event->xany.display, event);
76 #else 77 #else
77 NOTIMPLEMENTED(); 78 NOTIMPLEMENTED();
78 #endif 79 #endif
79 return ui::POST_DISPATCH_NONE; 80 return ui::kPostDispatchNone;
80 case NestedAcceleratorDelegate::RESULT_PROCESSED: 81 case NestedAcceleratorDelegate::RESULT_PROCESSED:
81 return ui::POST_DISPATCH_NONE; 82 return ui::kPostDispatchNone;
82 case NestedAcceleratorDelegate::RESULT_NOT_PROCESSED: 83 case NestedAcceleratorDelegate::RESULT_NOT_PROCESSED:
83 break; 84 break;
84 } 85 }
85 } 86 }
86 ui::PlatformEventDispatcher* prev = *restore_dispatcher_; 87 ui::PlatformEventDispatcher* prev = *restore_dispatcher_;
87 88
88 return prev ? prev->DispatchEvent(event) 89 return prev ? prev->DispatchEvent(event) : ui::kPostDispatchPerformDefault;
89 : ui::POST_DISPATCH_PERFORM_DEFAULT;
90 } 90 }
91 91
92 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; 92 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux); 94 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux);
95 }; 95 };
96 96
97 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( 97 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create(
98 NestedAcceleratorDelegate* delegate, 98 NestedAcceleratorDelegate* delegate,
99 base::MessagePumpDispatcher* nested_dispatcher) { 99 base::MessagePumpDispatcher* nested_dispatcher) {
100 return scoped_ptr<NestedAcceleratorDispatcher>( 100 return scoped_ptr<NestedAcceleratorDispatcher>(
101 new NestedAcceleratorDispatcherLinux(delegate)); 101 new NestedAcceleratorDispatcherLinux(delegate));
102 } 102 }
103 103
104 } // namespace wm 104 } // namespace wm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698