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

Side by Side Diff: ash/mus/accelerator_registrar_impl.cc

Issue 1939133002: StructTraits to map mus::mojom::Event to unique_ptr<ui::Event> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback. Created 4 years, 6 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 | « ash/mus/accelerator_registrar_impl.h ('k') | ash/mus/accelerator_registrar_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ash/mus/accelerator_registrar_impl.h" 5 #include "ash/mus/accelerator_registrar_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/mus/root_window_controller.h" 10 #include "ash/mus/root_window_controller.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 void AcceleratorRegistrarImpl::Destroy() { 51 void AcceleratorRegistrarImpl::Destroy() {
52 delete this; 52 delete this;
53 } 53 }
54 54
55 bool AcceleratorRegistrarImpl::OwnsAccelerator(uint32_t accelerator_id) const { 55 bool AcceleratorRegistrarImpl::OwnsAccelerator(uint32_t accelerator_id) const {
56 return !!accelerators_.count(accelerator_id); 56 return !!accelerators_.count(accelerator_id);
57 } 57 }
58 58
59 void AcceleratorRegistrarImpl::ProcessAccelerator( 59 void AcceleratorRegistrarImpl::ProcessAccelerator(uint32_t accelerator_id,
60 uint32_t accelerator_id, 60 const ui::Event& event) {
61 ::mus::mojom::EventPtr event) {
62 DCHECK(OwnsAccelerator(accelerator_id)); 61 DCHECK(OwnsAccelerator(accelerator_id));
62 // TODO(moshayedi): crbug.com/617167. Don't clone even once we map
63 // mojom::Event directly to ui::Event.
63 accelerator_handler_->OnAccelerator(accelerator_id & kAcceleratorIdMask, 64 accelerator_handler_->OnAccelerator(accelerator_id & kAcceleratorIdMask,
64 std::move(event)); 65 ui::Event::Clone(event));
65 } 66 }
66 67
67 AcceleratorRegistrarImpl::~AcceleratorRegistrarImpl() { 68 AcceleratorRegistrarImpl::~AcceleratorRegistrarImpl() {
68 wm_app_->RemoveRootWindowsObserver(this); 69 wm_app_->RemoveRootWindowsObserver(this);
69 RemoveAllAccelerators(); 70 RemoveAllAccelerators();
70 destroy_callback_.Run(this); 71 destroy_callback_.Run(this);
71 } 72 }
72 73
73 uint32_t AcceleratorRegistrarImpl::ComputeAcceleratorId( 74 uint32_t AcceleratorRegistrarImpl::ComputeAcceleratorId(
74 uint32_t accelerator_id) const { 75 uint32_t accelerator_id) const {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 164 }
164 165
165 void AcceleratorRegistrarImpl::OnRootWindowControllerAdded( 166 void AcceleratorRegistrarImpl::OnRootWindowControllerAdded(
166 RootWindowController* controller) { 167 RootWindowController* controller) {
167 for (const auto& pair : accelerators_) 168 for (const auto& pair : accelerators_)
168 AddAcceleratorToRoot(controller, pair.first); 169 AddAcceleratorToRoot(controller, pair.first);
169 } 170 }
170 171
171 } // namespace mus 172 } // namespace mus
172 } // namespace ash 173 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/accelerator_registrar_impl.h ('k') | ash/mus/accelerator_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698