<commit_before>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <Carbon/Carbon.h>

#include "chrome/browser/global_keyboard_shortcuts_mac.h"

#include "base/basictypes.h"
#include "chrome/app/chrome_dll_resource.h"

const KeyboardShortcutData* GetWindowKeyboardShortcutTable
    (size_t* num_entries) {
  static const KeyboardShortcutData keyboard_shortcuts[] = {
    {true,  true,  false, kVK_ANSI_RightBracket, IDC_SELECT_NEXT_TAB},
    {false, false, true,  kVK_PageDown,      IDC_SELECT_NEXT_TAB},
    {false, false, true,  kVK_Tab,           IDC_SELECT_NEXT_TAB},
    {true,  true,  false, kVK_ANSI_LeftBracket, IDC_SELECT_PREVIOUS_TAB},
    {false, false, true,  kVK_PageUp,        IDC_SELECT_PREVIOUS_TAB},
    {false, true,  true,  kVK_Tab,           IDC_SELECT_PREVIOUS_TAB},
    // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
    {true,  false, false, kVK_ANSI_1,        IDC_SELECT_TAB_0},
    {true,  false, false, kVK_ANSI_2,        IDC_SELECT_TAB_1},
    {true,  false, false, kVK_ANSI_3,        IDC_SELECT_TAB_2},
    {true,  false, false, kVK_ANSI_4,        IDC_SELECT_TAB_3},
    {true,  false, false, kVK_ANSI_5,        IDC_SELECT_TAB_4},
    {true,  false, false, kVK_ANSI_6,        IDC_SELECT_TAB_5},
    {true,  false, false, kVK_ANSI_7,        IDC_SELECT_TAB_6},
    {true,  false, false, kVK_ANSI_8,        IDC_SELECT_TAB_7},
    {true,  false, false, kVK_ANSI_9,        IDC_SELECT_LAST_TAB},
  };

  *num_entries = arraysize(keyboard_shortcuts);

  return keyboard_shortcuts;
}

const KeyboardShortcutData* GetBrowserKeyboardShortcutTable
    (size_t* num_entries) {
  static const KeyboardShortcutData keyboard_shortcuts[] = {
    {true,  false, false, kVK_LeftArrow,     IDC_BACK},
    {true,  false, false, kVK_RightArrow,    IDC_FORWARD},
    {false, false, false, kVK_Delete,        IDC_BACK},
    {false, true,  false, kVK_Delete,        IDC_FORWARD},
  };

  *num_entries = arraysize(keyboard_shortcuts);

  return keyboard_shortcuts;
}

static int CommandForKeyboardShortcut(
    const KeyboardShortcutData* (*get_keyboard_shortcut_table)(size_t*),
    bool command_key, bool shift_key, bool cntrl_key, int vkey_code) {

  // Scan through keycodes and see if it corresponds to one of the global
  // shortcuts on file.
  //<commit_msg>Disable backspace until I have fixed it in IME mode.<commit_after>// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <Carbon/Carbon.h>

#include "chrome/browser/global_keyboard_shortcuts_mac.h"

#include "base/basictypes.h"
#include "chrome/app/chrome_dll_resource.h"

const KeyboardShortcutData* GetWindowKeyboardShortcutTable
    (size_t* num_entries) {
  static const KeyboardShortcutData keyboard_shortcuts[] = {
    {true,  true,  false, kVK_ANSI_RightBracket, IDC_SELECT_NEXT_TAB},
    {false, false, true,  kVK_PageDown,      IDC_SELECT_NEXT_TAB},
    {false, false, true,  kVK_Tab,           IDC_SELECT_NEXT_TAB},
    {true,  true,  false, kVK_ANSI_LeftBracket, IDC_SELECT_PREVIOUS_TAB},
    {false, false, true,  kVK_PageUp,        IDC_SELECT_PREVIOUS_TAB},
    {false, true,  true,  kVK_Tab,           IDC_SELECT_PREVIOUS_TAB},
    // Cmd-0..8 select the Nth tab, with cmd-9 being "last tab".
    {true,  false, false, kVK_ANSI_1,        IDC_SELECT_TAB_0},
    {true,  false, false, kVK_ANSI_2,        IDC_SELECT_TAB_1},
    {true,  false, false, kVK_ANSI_3,        IDC_SELECT_TAB_2},
    {true,  false, false, kVK_ANSI_4,        IDC_SELECT_TAB_3},
    {true,  false, false, kVK_ANSI_5,        IDC_SELECT_TAB_4},
    {true,  false, false, kVK_ANSI_6,        IDC_SELECT_TAB_5},
    {true,  false, false, kVK_ANSI_7,        IDC_SELECT_TAB_6},
    {true,  false, false, kVK_ANSI_8,        IDC_SELECT_TAB_7},
    {true,  false, false, kVK_ANSI_9,        IDC_SELECT_LAST_TAB},
  };

  *num_entries = arraysize(keyboard_shortcuts);

  return keyboard_shortcuts;
}

const KeyboardShortcutData* GetBrowserKeyboardShortcutTable
    (size_t* num_entries) {
  static const KeyboardShortcutData keyboard_shortcuts[] = {
    {true,  false, false, kVK_LeftArrow,     IDC_BACK},
    {true,  false, false, kVK_RightArrow,    IDC_FORWARD},
  };

  *num_entries = arraysize(keyboard_shortcuts);

  return keyboard_shortcuts;
}

static int CommandForKeyboardShortcut(
    const KeyboardShortcutData* (*get_keyboard_shortcut_table)(size_t*),
    bool command_key, bool shift_key, bool cntrl_key, int vkey_code) {

  // Scan through keycodes and see if it corresponds to one of the global
  // shortcuts on file.
  //
{'fraction_non_alphanumeric': 0.09717537942664418, 'fraction_numerical': 0.01011804384485666, 'mean_word_length': 3.698019801980198, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5620829', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1765, 'n_words': 395}