Remove PlatformAccelerator
https://chromium-review.googlesource.com/c/chromium/src/+/1140211
This commit is contained in:
parent
7ce338e420
commit
b57b342352
6 changed files with 6 additions and 73 deletions
|
@ -64,7 +64,6 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
}
|
||||
|
||||
*accelerator = ui::Accelerator(key, modifiers);
|
||||
SetPlatformAccelerator(accelerator);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
|
|||
bool StringToAccelerator(const std::string& description,
|
||||
ui::Accelerator* accelerator);
|
||||
|
||||
// Set platform accelerator for the Accelerator.
|
||||
void SetPlatformAccelerator(ui::Accelerator* accelerator);
|
||||
|
||||
// Generate a table that contains memu model's accelerators and command ids.
|
||||
void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||
atom::AtomMenuModel* model);
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) 2013 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/accelerator_util.h"
|
||||
|
||||
#include "ui/base/accelerators/accelerator.h"
|
||||
#import "ui/base/accelerators/platform_accelerator_cocoa.h"
|
||||
#import "ui/events/keycodes/keyboard_code_conversion_mac.h"
|
||||
|
||||
namespace accelerator_util {
|
||||
|
||||
void SetPlatformAccelerator(ui::Accelerator* accelerator) {
|
||||
unichar character;
|
||||
unichar characterIgnoringModifiers;
|
||||
|
||||
NSUInteger modifiers = (accelerator->IsCtrlDown() ? NSControlKeyMask : 0) |
|
||||
(accelerator->IsCmdDown() ? NSCommandKeyMask : 0) |
|
||||
(accelerator->IsAltDown() ? NSAlternateKeyMask : 0) |
|
||||
(accelerator->IsShiftDown() ? NSShiftKeyMask : 0);
|
||||
|
||||
ui::MacKeyCodeForWindowsKeyCode(accelerator->key_code(), modifiers,
|
||||
&character, &characterIgnoringModifiers);
|
||||
|
||||
if (character != characterIgnoringModifiers) {
|
||||
if (isdigit(characterIgnoringModifiers)) {
|
||||
// The character is a number so lets not mutate it with the modifiers
|
||||
character = characterIgnoringModifiers;
|
||||
} else {
|
||||
modifiers ^= NSShiftKeyMask;
|
||||
}
|
||||
}
|
||||
|
||||
if (character == NSDeleteFunctionKey) {
|
||||
character = NSDeleteCharacter;
|
||||
}
|
||||
|
||||
NSString* characters =
|
||||
[[[NSString alloc] initWithCharacters:&character length:1] autorelease];
|
||||
|
||||
std::unique_ptr<ui::PlatformAccelerator> platform_accelerator(
|
||||
new ui::PlatformAcceleratorCocoa(characters, modifiers));
|
||||
accelerator->set_platform_accelerator(std::move(platform_accelerator));
|
||||
}
|
||||
|
||||
} // namespace accelerator_util
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (c) 2013 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/browser/ui/accelerator_util.h"
|
||||
|
||||
#include "ui/base/accelerators/accelerator.h"
|
||||
|
||||
namespace accelerator_util {
|
||||
|
||||
void SetPlatformAccelerator(ui::Accelerator* accelerator) {}
|
||||
|
||||
} // namespace accelerator_util
|
|
@ -239,14 +239,12 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
|
|||
ui::Accelerator accelerator;
|
||||
if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_,
|
||||
&accelerator)) {
|
||||
const ui::PlatformAcceleratorCocoa* platformAccelerator =
|
||||
static_cast<const ui::PlatformAcceleratorCocoa*>(
|
||||
accelerator.platform_accelerator());
|
||||
if (platformAccelerator) {
|
||||
[item setKeyEquivalent:platformAccelerator->characters()];
|
||||
[item
|
||||
setKeyEquivalentModifierMask:platformAccelerator->modifier_mask()];
|
||||
}
|
||||
NSString* key_equivalent;
|
||||
NSUInteger modifier_mask;
|
||||
GetKeyEquivalentAndModifierMaskFromAccelerator(
|
||||
accelerator, &key_equivalent, &modifier_mask);
|
||||
[item setKeyEquivalent:key_equivalent];
|
||||
[item setKeyEquivalentModifierMask:modifier_mask];
|
||||
}
|
||||
|
||||
// Set menu item's role.
|
||||
|
|
|
@ -336,8 +336,6 @@ filenames = {
|
|||
"atom/browser/special_storage_policy.h",
|
||||
"atom/browser/ui/accelerator_util.cc",
|
||||
"atom/browser/ui/accelerator_util.h",
|
||||
"atom/browser/ui/accelerator_util_mac.mm",
|
||||
"atom/browser/ui/accelerator_util_views.cc",
|
||||
"atom/browser/ui/atom_menu_model.cc",
|
||||
"atom/browser/ui/atom_menu_model.h",
|
||||
"atom/browser/ui/autofill_popup.cc",
|
||||
|
|
Loading…
Add table
Reference in a new issue