Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / native_web_keyboard_event.cc
blob646b358ac8d6dd8680a8d87eb081c5c6d8319b44
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/browser/native_web_keyboard_event.h"
7 #include "ui/events/event_constants.h"
9 namespace content {
11 int GetModifiersFromNativeWebKeyboardEvent(
12 const NativeWebKeyboardEvent& event) {
13 int modifiers = ui::EF_NONE;
14 if (event.modifiers & NativeWebKeyboardEvent::ShiftKey)
15 modifiers |= ui::EF_SHIFT_DOWN;
16 if (event.modifiers & NativeWebKeyboardEvent::ControlKey)
17 modifiers |= ui::EF_CONTROL_DOWN;
18 if (event.modifiers & NativeWebKeyboardEvent::AltKey)
19 modifiers |= ui::EF_ALT_DOWN;
20 #if defined(OS_MACOSX)
21 if (event.modifiers & NativeWebKeyboardEvent::MetaKey)
22 modifiers |= ui::EF_COMMAND_DOWN;
23 #endif
24 return modifiers;
27 } // namespace content