| OLD | NEW |
| 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 "content/child/blink_platform_impl.h" | 5 #include "content/child/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" | 64 #include "third_party/WebKit/public/platform/WebConvertableToTraceFormat.h" |
| 65 #include "third_party/WebKit/public/platform/WebData.h" | 65 #include "third_party/WebKit/public/platform/WebData.h" |
| 66 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 66 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
| 67 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" | 67 #include "third_party/WebKit/public/platform/WebMemoryDumpProvider.h" |
| 68 #include "third_party/WebKit/public/platform/WebString.h" | 68 #include "third_party/WebKit/public/platform/WebString.h" |
| 69 #include "third_party/WebKit/public/platform/WebURL.h" | 69 #include "third_party/WebKit/public/platform/WebURL.h" |
| 70 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 70 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 71 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 71 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
| 72 #include "ui/base/layout.h" | 72 #include "ui/base/layout.h" |
| 73 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 73 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 74 #include "ui/events/keycodes/dom/dom_key.h" | |
| 75 #include "ui/events/keycodes/dom/keycode_converter.h" | 74 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 76 | 75 |
| 77 using blink::WebData; | 76 using blink::WebData; |
| 78 using blink::WebFallbackThemeEngine; | 77 using blink::WebFallbackThemeEngine; |
| 79 using blink::WebLocalizedString; | 78 using blink::WebLocalizedString; |
| 80 using blink::WebString; | 79 using blink::WebString; |
| 81 using blink::WebThemeEngine; | 80 using blink::WebThemeEngine; |
| 82 using blink::WebURL; | 81 using blink::WebURL; |
| 83 using blink::WebURLError; | 82 using blink::WebURLError; |
| 84 using blink::WebURLLoader; | 83 using blink::WebURLLoader; |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 WebString BlinkPlatformImpl::domCodeStringFromEnum(int dom_code) { | 1385 WebString BlinkPlatformImpl::domCodeStringFromEnum(int dom_code) { |
| 1387 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1386 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
| 1388 static_cast<ui::DomCode>(dom_code))); | 1387 static_cast<ui::DomCode>(dom_code))); |
| 1389 } | 1388 } |
| 1390 | 1389 |
| 1391 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1390 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
| 1392 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1391 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
| 1393 code.utf8().data())); | 1392 code.utf8().data())); |
| 1394 } | 1393 } |
| 1395 | 1394 |
| 1396 WebString BlinkPlatformImpl::domKeyStringFromEnum(int dom_key) { | |
| 1397 if (dom_key < DOM_KEY_PRINT_NON_DIFF) { | |
| 1398 std::string dom_key_char = base::StringPrintf("%c", dom_key); | |
| 1399 return WebString::fromUTF8(dom_key_char); | |
| 1400 } else { | |
| 1401 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | |
| 1402 static_cast<ui::DomKey>(dom_key - DOM_KEY_PRINT_NON_DIFF))); | |
| 1403 } | |
| 1404 } | |
| 1405 | |
| 1406 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key) { | |
| 1407 ui::DomKey dom_key = | |
| 1408 ui::KeycodeConverter::KeyStringToDomKey(key.utf8().data()); | |
| 1409 if (ui::DomKey::NONE == dom_key) { | |
| 1410 return key.at(0); | |
| 1411 } | |
| 1412 return static_cast<int>(dom_key); | |
| 1413 } | |
| 1414 | |
| 1415 } // namespace content | 1395 } // namespace content |
| OLD | NEW |