Remove #define in c/b/ui/accelerator_table.cc (#36599)
* Remove #define in c/b/ui/accelerator_table.cc Replaces #define macro with plaster + chromium_src override. plaster will rename GetAcceleratorList() to GetAcceleratorList_ChromiumImpl() so that we can have our own implementation of GetAcceleratorList().
This commit is contained in:
@@ -3,17 +3,12 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "chrome/browser/ui/accelerator_table.h"
|
||||
|
||||
#include "base/containers/extend.h"
|
||||
#include "brave/app/brave_command_ids.h"
|
||||
#include "brave/components/commander/common/buildflags/buildflags.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
|
||||
#define GetAcceleratorList GetAcceleratorList_ChromiumImpl
|
||||
#include <chrome/browser/ui/accelerator_table.cc>
|
||||
#undef GetAcceleratorList
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -41,6 +36,10 @@ constexpr AcceleratorMapping kBraveAcceleratorMap[] = {
|
||||
|
||||
} // namespace
|
||||
|
||||
// Our own version of GetAcceleratorList(). This removes the upstream
|
||||
// accelerator for new split tab on Windows and Linux, as it conflicts with our
|
||||
// existing Tor shortcut (see `kBraveAcceleratorMap`) and adds our own
|
||||
// accelerators.
|
||||
std::vector<AcceleratorMapping> GetAcceleratorList() {
|
||||
std::vector<AcceleratorMapping> accelerator_list(
|
||||
GetAcceleratorList_ChromiumImpl());
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/chrome/browser/ui/accelerator_table.cc b/chrome/browser/ui/accelerator_table.cc
|
||||
index 51837acdf5a13e6ae75e163943d977c85c6c7fd1..234c5d6a24808f0734411e8398f179f1283060b2 100644
|
||||
--- a/chrome/browser/ui/accelerator_table.cc
|
||||
+++ b/chrome/browser/ui/accelerator_table.cc
|
||||
@@ -305,7 +305,7 @@ std::vector<AcceleratorMapping>* GetAcceleratorsPointer() {
|
||||
|
||||
} // namespace
|
||||
|
||||
-std::vector<AcceleratorMapping> GetAcceleratorList() {
|
||||
+std::vector<AcceleratorMapping> GetAcceleratorList_ChromiumImpl() {
|
||||
std::vector<AcceleratorMapping>* accelerators = GetAcceleratorsPointer();
|
||||
|
||||
if (accelerators->empty()) {
|
||||
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2026 The Brave Authors. All rights reserved.
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
substitutions:
|
||||
- description: |-
|
||||
Rename GetAcceleratorList() to GetAcceleratorList_ChromiumImpl() so that
|
||||
we can have our own implementation of GetAcceleratorList().
|
||||
re_pattern: '(std::vector<AcceleratorMapping>\ GetAcceleratorList)(\(\)\ {)'
|
||||
replace: '\1_ChromiumImpl\2'
|
||||
Reference in New Issue
Block a user