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

Side by Side Diff: ash/key_event_watcher.cc

Issue 2736573002: chromeos: Move files in //ash/common to //ash, part 2 (Closed)
Patch Set: Created 3 years, 9 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/key_event_watcher.h ('k') | ash/keyboard/keyboard_ui.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/common/key_event_watcher.h" 5 #include "ash/key_event_watcher.h"
6 6
7 namespace ash { 7 namespace ash {
8 8
9 KeyEventWatcher::KeyEventWatcher() {} 9 KeyEventWatcher::KeyEventWatcher() {}
10 10
11 KeyEventWatcher::~KeyEventWatcher() {} 11 KeyEventWatcher::~KeyEventWatcher() {}
12 12
13 void KeyEventWatcher::AddKeyEventCallback(const ui::Accelerator& key, 13 void KeyEventWatcher::AddKeyEventCallback(const ui::Accelerator& key,
14 const KeyEventCallback& callback) { 14 const KeyEventCallback& callback) {
15 callback_map_.insert(std::make_pair(key, callback)); 15 callback_map_.insert(std::make_pair(key, callback));
16 } 16 }
17 17
18 bool KeyEventWatcher::HandleKeyEvent(const ui::KeyEvent& event) { 18 bool KeyEventWatcher::HandleKeyEvent(const ui::KeyEvent& event) {
19 auto iter = callback_map_.find(ui::Accelerator(event)); 19 auto iter = callback_map_.find(ui::Accelerator(event));
20 if (iter != callback_map_.end()) { 20 if (iter != callback_map_.end()) {
21 iter->second.Run(event); 21 iter->second.Run(event);
22 return true; 22 return true;
23 } 23 }
24 return false; 24 return false;
25 } 25 }
26 26
27 } // namespace ash 27 } // namespace ash
OLDNEW
« no previous file with comments | « ash/key_event_watcher.h ('k') | ash/keyboard/keyboard_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698