function initKeyboardOverlayId(inputMethodId) {
  // Libcros returns an empty string when it cannot find the keyboard overlay ID
  // corresponding to the current input method.
  // In such a case, fallback to the default ID (en_US).
  var inputMethodIdToOverlayId =
      keyboardOverlayData['inputMethodIdToOverlayId'];
  if (inputMethodId) {
    if (inputMethodId.startsWith(IME_ID_PREFIX)) {
      // If the input method is a component extension IME, remove the prefix:
      //   _comp_ime_<ext_id>
      // The extension id is a hash value with 32 characters.
      inputMethodId =
          inputMethodId.slice(IME_ID_PREFIX.length + EXTENSION_ID_LEN);
    }
    keyboardOverlayId = inputMethodIdToOverlayId[inputMethodId];
  }
  if (!keyboardOverlayId) {
    console.error('No keyboard overlay ID for ' + inputMethodId);
    keyboardOverlayId = 'en_US';
  }
  while (document.body.firstChild) {
    document.body.removeChild(document.body.firstChild);
  }
  // We show Japanese layout as-is because the user has chosen the layout
  // that is quite diffrent from the physical layout that has a diamond key.
  if (hasDiamondKey() && getLayoutName() != 'J')
    initDiamondKey();
  else if (hasKeyboardLayout2())
    initKeyboardLayout2();

  initLayout();
  update([], []);
  window.webkitRequestAnimationFrame(function() {
    chrome.send('didPaint');
  });
}
/**
 * Initializes the global keyboad overlay ID and the layout of keys.
 * Called after sending the 'getInputMethodId' message.
 * @param {inputMethodId} inputMethodId Input Method Identifier.
 */
Initializes the global keyboad overlay ID and the layout of keys.
Called after sending the 'getInputMethodId' message.
Initializes the global keyboad overlay ID and the layout of keys . Called after sending the ' getInputMethodId ' message .
function initKeyboardOverlayId(inputMethodId) {
  var inputMethodIdToOverlayId =
      keyboardOverlayData['inputMethodIdToOverlayId'];
  if (inputMethodId) {
    if (inputMethodId.startsWith(IME_ID_PREFIX)) {
      inputMethodId =
          inputMethodId.slice(IME_ID_PREFIX.length + EXTENSION_ID_LEN);
    }
    keyboardOverlayId = inputMethodIdToOverlayId[inputMethodId];
  }
  if (!keyboardOverlayId) {
    console.error('No keyboard overlay ID for ' + inputMethodId);
    keyboardOverlayId = 'en_US';
  }
  while (document.body.firstChild) {
    document.body.removeChild(document.body.firstChild);
  }
  if (hasDiamondKey() && getLayoutName() != 'J')
    initDiamondKey();
  else if (hasKeyboardLayout2())
    initKeyboardLayout2();
  initLayout();
  update([], []);
  window.webkitRequestAnimationFrame(function() {
    chrome.send('didPaint');
  });
}
function initKeyboardOverlayId ( inputMethodId ) { var inputMethodIdToOverlayId = keyboardOverlayData [ 'inputMethodIdToOverlayId' ] ; if ( inputMethodId ) { if ( inputMethodId . startsWith ( IME_ID_PREFIX ) ) { inputMethodId = inputMethodId . slice ( IME_ID_PREFIX . length + EXTENSION_ID_LEN ) ; } keyboardOverlayId = inputMethodIdToOverlayId [ inputMethodId ] ; } if ( ! keyboardOverlayId ) { console . error ( 'No keyboard overlay ID for ' + inputMethodId ) ; keyboardOverlayId = 'en_US' ; } while ( document . body . firstChild ) { document . body . removeChild ( document . body . firstChild ) ; } if ( hasDiamondKey ( ) && getLayoutName ( ) != 'J' ) initDiamondKey ( ) ; else if ( hasKeyboardLayout2 ( ) ) initKeyboardLayout2 ( ) ; initLayout ( ) ; update ( [ ] , [ ] ) ; window . webkitRequestAnimationFrame ( function ( ) { chrome . send ( 'didPaint' ) ; } ) ; }
Initializes the global keyboad overlay ID and the layout of keys.
Initializes the global keyboad overlay ID and the layout of keys .
// Libcros returns an empty string when it cannot find the keyboard overlay ID // corresponding to the current input method. // In such a case, fallback to the default ID (en_US). // If the input method is a component extension IME, remove the prefix: //   _comp_ime_<ext_id> // The extension id is a hash value with 32 characters. // We show Japanese layout as-is because the user has chosen the layout // that is quite diffrent from the physical layout that has a diamond key.