OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/key_identifier_conversion_views.h" | 5 #include "chrome/browser/extensions/key_identifier_conversion_views.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "ui/base/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
13 #include "views/events/event.h" | 13 #include "views/events/event.h" |
14 | 14 |
| 15 using content::BrowserThread; |
| 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 static const int kNumIdentifierTypes = 3; | 19 static const int kNumIdentifierTypes = 3; |
18 | 20 |
19 typedef struct KeyIdentifier { | 21 typedef struct KeyIdentifier { |
20 // In order: key identifier, character and unicode codepoint. They are | 22 // In order: key identifier, character and unicode codepoint. They are |
21 // searched in that order as well. | 23 // searched in that order as well. |
22 // These are all placed into a single array as they are treated uniformly and | 24 // These are all placed into a single array as they are treated uniformly and |
23 // we never refer to a specific type of identifier. This reduces code | 25 // we never refer to a specific type of identifier. This reduces code |
24 // duplication below. | 26 // duplication below. |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 for (int i = 0; i < kNumIdentifierTypes; ++i) { | 329 for (int i = 0; i < kNumIdentifierTypes; ++i) { |
328 const IdentifierMap& map = *identifierMaps[i]; | 330 const IdentifierMap& map = *identifierMaps[i]; |
329 | 331 |
330 IdentifierMap::const_iterator iter = map.find(key_identifier); | 332 IdentifierMap::const_iterator iter = map.find(key_identifier); |
331 if (iter != map.end()) | 333 if (iter != map.end()) |
332 return *iter->second; | 334 return *iter->second; |
333 } | 335 } |
334 | 336 |
335 return *kUnknownKeyEvent; | 337 return *kUnknownKeyEvent; |
336 } | 338 } |
OLD | NEW |