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

Side by Side Diff: chrome/browser/extensions/api/braille_display_private/brlapi_keycode_map.cc

Issue 2463983002: Implement support for chorded braille commands (Closed)
Patch Set: Indent. Created 4 years, 1 month 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 | « no previous file | chrome/browser/resources/chromeos/chromevox/BUILD.gn » ('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 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 "chrome/browser/extensions/api/braille_display_private/brlapi_keycode_m ap.h" 5 #include "chrome/browser/extensions/api/braille_display_private/brlapi_keycode_m ap.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversion_utils.h" 10 #include "base/strings/utf_string_conversion_utils.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 case BRLAPI_KEY_CMD_BOT: 135 case BRLAPI_KEY_CMD_BOT:
136 event->command = KEY_COMMAND_BOTTOM; 136 event->command = KEY_COMMAND_BOTTOM;
137 break; 137 break;
138 default: 138 default:
139 switch (code & BRLAPI_KEY_CMD_BLK_MASK) { 139 switch (code & BRLAPI_KEY_CMD_BLK_MASK) {
140 case BRLAPI_KEY_CMD_ROUTE: 140 case BRLAPI_KEY_CMD_ROUTE:
141 event->command = KEY_COMMAND_ROUTING; 141 event->command = KEY_COMMAND_ROUTING;
142 event->display_position.reset(new int(argument)); 142 event->display_position.reset(new int(argument));
143 break; 143 break;
144 case BRLAPI_KEY_CMD_PASSDOTS: 144 case BRLAPI_KEY_CMD_PASSDOTS:
145 event->command = KEY_COMMAND_DOTS; 145 unsigned int dots = argument & kAllDots;
146 event->braille_dots.reset(new int(argument & kAllDots)); 146 event->braille_dots.reset(new int(dots));
asargent_no_longer_on_chrome 2016/11/04 19:52:35 nit: consider using base::MakeUnique, which I thin
147
148 // BRLAPI_DOTC represents when the braille space key is pressed.
149 if (dots && (argument & BRLAPI_DOTC))
150 event->command = KEY_COMMAND_CHORD;
151 else
152 event->command = KEY_COMMAND_DOTS;
147 MapModifierFlags(code, event); 153 MapModifierFlags(code, event);
148 break; 154 break;
149 } 155 }
150 } 156 }
151 } 157 }
152 158
153 } // namespace 159 } // namespace
154 160
155 std::unique_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code) { 161 std::unique_ptr<KeyEvent> BrlapiKeyCodeToEvent(brlapi_keyCode_t code) {
156 std::unique_ptr<KeyEvent> result(new KeyEvent); 162 std::unique_ptr<KeyEvent> result(new KeyEvent);
157 result->command = KEY_COMMAND_NONE; 163 result->command = KEY_COMMAND_NONE;
158 switch (code & BRLAPI_KEY_TYPE_MASK) { 164 switch (code & BRLAPI_KEY_TYPE_MASK) {
159 case BRLAPI_KEY_TYPE_SYM: 165 case BRLAPI_KEY_TYPE_SYM:
160 MapKeySym(code, result.get()); 166 MapKeySym(code, result.get());
161 break; 167 break;
162 case BRLAPI_KEY_TYPE_CMD: 168 case BRLAPI_KEY_TYPE_CMD:
163 MapCommand(code, result.get()); 169 MapCommand(code, result.get());
164 break; 170 break;
165 } 171 }
166 if (result->command == KEY_COMMAND_NONE) 172 if (result->command == KEY_COMMAND_NONE)
167 result.reset(); 173 result.reset();
168 return result; 174 return result;
169 } 175 }
170 176
171 } // namespace braille_display_private 177 } // namespace braille_display_private
172 } // namespace api 178 } // namespace api
173 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698