Home | History | Annotate | Download | only in remoting
      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 "chrome/test/remoting/key_code_conv.h"
      6 
      7 #include "chrome/test/remoting/key_code_map.h"
      8 
      9 namespace remoting {
     10 
     11 ui::KeyboardCode InvalidKeyboardCode() {
     12   return key_code_map[0].vkey_code;
     13 }
     14 
     15 void GetKeyValuesFromChar(
     16     char c, const char** code, ui::KeyboardCode* vkey_code, bool* shift) {
     17   *code = NULL;
     18   *vkey_code = InvalidKeyboardCode();
     19 
     20   for (size_t i = 0; i < arraysize(key_code_map); ++i) {
     21     if (key_code_map[i].lower_char == c) {
     22       *code = key_code_map[i].code;
     23       *vkey_code = key_code_map[i].vkey_code;
     24       *shift = false;
     25       return;
     26     }
     27 
     28     if (key_code_map[i].upper_char == c) {
     29       *code = key_code_map[i].code;
     30       *vkey_code = key_code_map[i].vkey_code;
     31       *shift = true;
     32     }
     33   }
     34 }
     35 
     36 }  // namespace remoting
     37