OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 InspectorInputAgent::InspectorInputAgent(InspectorPageAgent* pageAgent, Inspecto
rClient* client) | 93 InspectorInputAgent::InspectorInputAgent(InspectorPageAgent* pageAgent, Inspecto
rClient* client) |
94 : InspectorBaseAgent<InspectorInputAgent>("Input") | 94 : InspectorBaseAgent<InspectorInputAgent>("Input") |
95 , m_pageAgent(pageAgent), m_client(client) | 95 , m_pageAgent(pageAgent), m_client(client) |
96 { | 96 { |
97 } | 97 } |
98 | 98 |
99 InspectorInputAgent::~InspectorInputAgent() | 99 InspectorInputAgent::~InspectorInputAgent() |
100 { | 100 { |
101 } | 101 } |
102 | 102 |
103 void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
e, const int* modifiers, const double* timestamp, const String* text, const Stri
ng* unmodifiedText, const String* keyIdentifier, const String* code, const int*
windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const bool* autoRepeat,
const bool* isKeypad, const bool* isSystemKey) | 103 void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
e, const int* modifiers, const double* timestamp, const String* text, const Stri
ng* unmodifiedText, const String* keyIdentifier, const String* code, const Strin
g* key, const int* windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const
bool* autoRepeat, const bool* isKeypad, const bool* isSystemKey) |
104 { | 104 { |
105 PlatformEvent::Type convertedType; | 105 PlatformEvent::Type convertedType; |
106 if (type == "keyDown") | 106 if (type == "keyDown") |
107 convertedType = PlatformEvent::KeyDown; | 107 convertedType = PlatformEvent::KeyDown; |
108 else if (type == "keyUp") | 108 else if (type == "keyUp") |
109 convertedType = PlatformEvent::KeyUp; | 109 convertedType = PlatformEvent::KeyUp; |
110 else if (type == "char") | 110 else if (type == "char") |
111 convertedType = PlatformEvent::Char; | 111 convertedType = PlatformEvent::Char; |
112 else if (type == "rawKeyDown") | 112 else if (type == "rawKeyDown") |
113 convertedType = PlatformEvent::RawKeyDown; | 113 convertedType = PlatformEvent::RawKeyDown; |
114 else { | 114 else { |
115 *error = "Unrecognized type: " + type; | 115 *error = "Unrecognized type: " + type; |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 PlatformKeyboardEvent event( | 119 PlatformKeyboardEvent event( |
120 convertedType, | 120 convertedType, |
121 text ? *text : "", | 121 text ? *text : "", |
122 unmodifiedText ? *unmodifiedText : "", | 122 unmodifiedText ? *unmodifiedText : "", |
123 keyIdentifier ? *keyIdentifier : "", | 123 keyIdentifier ? *keyIdentifier : "", |
124 code ? *code : "", | 124 code ? *code : "", |
| 125 key ? *key : "", |
125 windowsVirtualKeyCode ? *windowsVirtualKeyCode : 0, | 126 windowsVirtualKeyCode ? *windowsVirtualKeyCode : 0, |
126 nativeVirtualKeyCode ? *nativeVirtualKeyCode : 0, | 127 nativeVirtualKeyCode ? *nativeVirtualKeyCode : 0, |
127 asBool(autoRepeat), | 128 asBool(autoRepeat), |
128 asBool(isKeypad), | 129 asBool(isKeypad), |
129 asBool(isSystemKey), | 130 asBool(isSystemKey), |
130 static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0), | 131 static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0), |
131 timestamp ? *timestamp : currentTime()); | 132 timestamp ? *timestamp : currentTime()); |
132 m_client->dispatchKeyEvent(event); | 133 m_client->dispatchKeyEvent(event); |
133 } | 134 } |
134 | 135 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 270 } |
270 | 271 |
271 void InspectorInputAgent::trace(Visitor* visitor) | 272 void InspectorInputAgent::trace(Visitor* visitor) |
272 { | 273 { |
273 visitor->trace(m_pageAgent); | 274 visitor->trace(m_pageAgent); |
274 InspectorBaseAgent::trace(visitor); | 275 InspectorBaseAgent::trace(visitor); |
275 } | 276 } |
276 | 277 |
277 } // namespace blink | 278 } // namespace blink |
278 | 279 |
OLD | NEW |