Index: ui/base/events/key_identifier_conversion.cc |
diff --git a/chrome/browser/extensions/key_identifier_conversion_views.cc b/ui/base/events/key_identifier_conversion.cc |
similarity index 97% |
rename from chrome/browser/extensions/key_identifier_conversion_views.cc |
rename to ui/base/events/key_identifier_conversion.cc |
index d87b61a0341c6b2e0c0dc50de6df5b2df712c79b..945dcde09cc2ff9b422e027c49481858f71a8b8c 100644 |
--- a/chrome/browser/extensions/key_identifier_conversion_views.cc |
+++ b/ui/base/events/key_identifier_conversion.cc |
@@ -2,21 +2,16 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/extensions/key_identifier_conversion_views.h" |
+#include "ui/base/events/key_identifier_conversion.h" |
#include <string.h> |
- |
#include <utility> |
#include "base/basictypes.h" |
#include "base/hash_tables.h" |
-#include "base/logging.h" |
-#include "content/public/browser/browser_thread.h" |
#include "ui/base/events/event.h" |
#include "ui/base/keycodes/keyboard_codes.h" |
-using content::BrowserThread; |
- |
namespace { |
static const int kNumIdentifierTypes = 3; |
sadrul
2013/04/15 02:05:12
We typically don't mark things 'static' in anonymo
bryeung
2013/04/15 15:34:13
Fixed (throughout).
|
@@ -34,7 +29,7 @@ typedef struct KeyIdentifier { |
// Taken from Section 6.3.3 here: |
// http://www.w3.org/TR/DOM-Level-3-Events/#keyset-keyidentifiers |
-// TODO(bryeung): keycodes could be wrong: I took the keydown code only |
+// WARNING: keycodes could be wrong, as they are based soley on keydown |
static const KeyIdentifier kKeyIdentifiers[] = { |
{ {"Accept", "", ""}, ui::VKEY_ACCEPT, 0 }, |
{ {"Add", "", ""}, ui::VKEY_ADD, 0 }, |
@@ -326,10 +321,11 @@ static void InitializeMaps() { |
} // namespace |
+namespace ui { |
const ui::KeyEvent& KeyEventFromKeyIdentifier( |
const std::string& key_identifier) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ // FIXME: what about races? |
bryeung
2013/04/14 15:40:16
Sadrul: do you know what the Right Way (TM) is to
sadrul
2013/04/15 02:05:12
You can keep a static base::PlatformThreadId in In
bryeung
2013/04/15 15:34:13
Works for me: I'll add a comment about that to the
|
InitializeMaps(); |
for (int i = 0; i < kNumIdentifierTypes; ++i) { |
@@ -342,3 +338,5 @@ const ui::KeyEvent& KeyEventFromKeyIdentifier( |
return *kUnknownKeyEvent; |
} |
+ |
+} // namespace ui |