Home | History | Annotate | Download | only in input
      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
      3 // found in the LICENSE file.
      4 
      5 #include "content/browser/renderer_host/input/web_input_event_util_posix.h"
      6 
      7 namespace content {
      8 
      9 ui::KeyboardCode GetWindowsKeyCodeWithoutLocation(ui::KeyboardCode key_code) {
     10   switch (key_code) {
     11     case ui::VKEY_LCONTROL:
     12     case ui::VKEY_RCONTROL:
     13       return ui::VKEY_CONTROL;
     14     case ui::VKEY_LSHIFT:
     15     case ui::VKEY_RSHIFT:
     16     return ui::VKEY_SHIFT;
     17     case ui::VKEY_LMENU:
     18     case ui::VKEY_RMENU:
     19       return ui::VKEY_MENU;
     20     default:
     21       return key_code;
     22   }
     23 }
     24 
     25 blink::WebInputEvent::Modifiers GetLocationModifiersFromWindowsKeyCode(
     26     ui::KeyboardCode key_code) {
     27   switch (key_code) {
     28     case ui::VKEY_LCONTROL:
     29     case ui::VKEY_LSHIFT:
     30     case ui::VKEY_LMENU:
     31     case ui::VKEY_LWIN:
     32       return blink::WebKeyboardEvent::IsLeft;
     33     case ui::VKEY_RCONTROL:
     34     case ui::VKEY_RSHIFT:
     35     case ui::VKEY_RMENU:
     36     case ui::VKEY_RWIN:
     37       return blink::WebKeyboardEvent::IsRight;
     38     default:
     39       return static_cast<blink::WebInputEvent::Modifiers>(0);
     40   }
     41 }
     42 
     43 }  // namespace content
     44