chromium/chrome/browser/ui/views/accelerator_table.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/accelerator_table.h"

#include <stddef.h>

#include <vector>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "components/lens/buildflags.h"
#include "components/lens/lens_features.h"
#include "printing/buildflags/buildflags.h"
#include "services/screen_ai/buildflags/buildflags.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event_constants.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/crosapi/browser_util.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace {

// For ChromeOS only: If you plan on adding a new accelerator and want it
// displayed in the Shortcuts app, please follow the instructions at:
// `ash/webui/shortcut_customization_ui/backend/accelerator_layout_table.h`.

// NOTE: Between each ifdef block, keep the list in the same
// (mostly-alphabetical) order as the Windows accelerators in
// ../../app/chrome_dll.rc.
// Do not use Ctrl-Alt as a shortcut modifier, as it is used by i18n keyboards:
// http://blogs.msdn.com/b/oldnewthing/archive/2004/03/29/101121.aspx
const AcceleratorMapping kAcceleratorMap[] =;

const AcceleratorMapping kDevToolsAcceleratorMap[] =;

#if BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES)
// Accelerators to enable if lens::features::kEnableRegionSearchKeyboardShortcut
// is true.
constexpr AcceleratorMapping kRegionSearchAcceleratorMap[] = {
    // TODO(nguyenbryan): This is a temporary hotkey; update when finalized.
    {ui::VKEY_E, ui::EF_SHIFT_DOWN | ui::EF_PLATFORM_ACCELERATOR,
     IDC_CONTENT_CONTEXT_LENS_REGION_SEARCH},
};
#endif  // BUILDFLAG(ENABLE_LENS_DESKTOP_GOOGLE_BRANDED_FEATURES)

constexpr int kDebugModifier =;

// Accelerators to enable if features::UIDebugTools is true.
constexpr AcceleratorMapping kUIDebugAcceleratorMap[] =;

const int kRepeatableCommandIds[] =;

std::vector<AcceleratorMapping>* GetAcceleratorsPointer() {}

}  // namespace

std::vector<AcceleratorMapping> GetAcceleratorList() {}

void ClearAcceleratorListForTesting() {}

bool GetStandardAcceleratorForCommandId(int command_id,
                                        ui::Accelerator* accelerator) {}

bool IsCommandRepeatable(int command_id) {}