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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_util.cc

Issue 1280473002: Update ToLower/UpperASCII API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 namespace content { 146 namespace content {
147 147
148 void UpdateWindowsKeyCodeAndKeyIdentifier(blink::WebKeyboardEvent* event, 148 void UpdateWindowsKeyCodeAndKeyIdentifier(blink::WebKeyboardEvent* event,
149 ui::KeyboardCode windows_key_code) { 149 ui::KeyboardCode windows_key_code) {
150 event->windowsKeyCode = windows_key_code; 150 event->windowsKeyCode = windows_key_code;
151 151
152 const char* id = GetKeyIdentifier(windows_key_code); 152 const char* id = GetKeyIdentifier(windows_key_code);
153 if (id) { 153 if (id) {
154 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1); 154 base::strlcpy(event->keyIdentifier, id, sizeof(event->keyIdentifier) - 1);
155 } else { 155 } else {
156 base::snprintf(event->keyIdentifier, 156 base::snprintf(
157 sizeof(event->keyIdentifier), 157 event->keyIdentifier,
158 "U+%04X", 158 sizeof(event->keyIdentifier),
159 base::ToUpperASCII(static_cast<int>(windows_key_code))); 159 "U+%04X",
160 base::ToUpperASCII(static_cast<base::char16>(windows_key_code)));
160 } 161 }
161 } 162 }
162 163
163 int WebEventModifiersToEventFlags(int modifiers) { 164 int WebEventModifiersToEventFlags(int modifiers) {
164 int flags = 0; 165 int flags = 0;
165 166
166 if (modifiers & blink::WebInputEvent::ShiftKey) 167 if (modifiers & blink::WebInputEvent::ShiftKey)
167 flags |= ui::EF_SHIFT_DOWN; 168 flags |= ui::EF_SHIFT_DOWN;
168 if (modifiers & blink::WebInputEvent::ControlKey) 169 if (modifiers & blink::WebInputEvent::ControlKey)
169 flags |= ui::EF_CONTROL_DOWN; 170 flags |= ui::EF_CONTROL_DOWN;
(...skipping 10 matching lines...) Expand all
180 flags |= ui::EF_RIGHT_MOUSE_BUTTON; 181 flags |= ui::EF_RIGHT_MOUSE_BUTTON;
181 if (modifiers & blink::WebInputEvent::CapsLockOn) 182 if (modifiers & blink::WebInputEvent::CapsLockOn)
182 flags |= ui::EF_CAPS_LOCK_DOWN; 183 flags |= ui::EF_CAPS_LOCK_DOWN;
183 if (modifiers & blink::WebInputEvent::IsAutoRepeat) 184 if (modifiers & blink::WebInputEvent::IsAutoRepeat)
184 flags |= ui::EF_IS_REPEAT; 185 flags |= ui::EF_IS_REPEAT;
185 186
186 return flags; 187 return flags;
187 } 188 }
188 189
189 } // namespace content 190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698