electron/shell/browser/ui/cocoa/electron_menu_controller.mm

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

558 lines
19 KiB
Text
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#import "shell/browser/ui/cocoa/electron_menu_controller.h"
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
2015-09-01 11:48:11 +00:00
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_task_traits.h"
2018-02-25 22:19:40 +00:00
#include "content/public/browser/browser_thread.h"
#include "net/base/mac/url_conversions.h"
#include "shell/browser/mac/electron_application.h"
#include "shell/browser/native_window.h"
#include "shell/browser/ui/electron_menu_model.h"
#include "shell/browser/window_list.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/events/cocoa/cocoa_event_utils.h"
#include "ui/events/keycodes/keyboard_code_conversion_mac.h"
#include "ui/gfx/image/image.h"
#include "ui/strings/grit/ui_strings.h"
2018-02-25 22:19:40 +00:00
using content::BrowserThread;
using SharingItem = electron::ElectronMenuModel::SharingItem;
2018-02-25 22:19:40 +00:00
2015-09-01 11:48:11 +00:00
namespace {
struct Role {
SEL selector;
const char* role;
};
Role kRolesMap[] = {
2018-04-20 18:47:04 +00:00
{@selector(orderFrontStandardAboutPanel:), "about"},
{@selector(hide:), "hide"},
{@selector(hideOtherApplications:), "hideothers"},
{@selector(unhideAllApplications:), "unhide"},
{@selector(arrangeInFront:), "front"},
{@selector(undo:), "undo"},
{@selector(redo:), "redo"},
{@selector(cut:), "cut"},
{@selector(copy:), "copy"},
{@selector(paste:), "paste"},
{@selector(delete:), "delete"},
{@selector(pasteAndMatchStyle:), "pasteandmatchstyle"},
{@selector(selectAll:), "selectall"},
{@selector(orderFrontSubstitutionsPanel:), "showsubstitutions"},
{@selector(toggleAutomaticQuoteSubstitution:), "togglesmartquotes"},
{@selector(toggleAutomaticDashSubstitution:), "togglesmartdashes"},
{@selector(toggleAutomaticTextReplacement:), "toggletextreplacement"},
2018-04-20 18:47:04 +00:00
{@selector(startSpeaking:), "startspeaking"},
{@selector(stopSpeaking:), "stopspeaking"},
{@selector(performMiniaturize:), "minimize"},
{@selector(performClose:), "close"},
{@selector(performZoom:), "zoom"},
{@selector(terminate:), "quit"},
// ↓ is intentionally not `toggleFullScreen`. The macOS full screen menu
// item behaves weird. If we use `toggleFullScreen`, then the menu item will
// use the default label, and not take the one provided.
{@selector(toggleFullScreenMode:), "togglefullscreen"},
{@selector(toggleTabBar:), "toggletabbar"},
{@selector(selectNextTab:), "selectnexttab"},
{@selector(selectPreviousTab:), "selectprevioustab"},
{@selector(mergeAllWindows:), "mergeallwindows"},
{@selector(moveTabToNewWindow:), "movetabtonewwindow"},
{@selector(clearRecentDocuments:), "clearrecentdocuments"},
2015-09-01 11:48:11 +00:00
};
// Called when adding a submenu to the menu and checks if the submenu, via its
// |model|, has visible child items.
bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) {
int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->IsVisibleAt(index))
return true;
}
return false;
}
// Called when an empty submenu is created. This inserts a menu item labeled
// "(empty)" into the submenu. Matches Windows behavior.
NSMenu* MakeEmptySubmenu() {
base::scoped_nsobject<NSMenu> submenu([[NSMenu alloc] initWithTitle:@""]);
NSString* empty_menu_title =
l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU);
[submenu addItemWithTitle:empty_menu_title action:NULL keyEquivalent:@""];
[[submenu itemAtIndex:0] setEnabled:NO];
return submenu.autorelease();
}
// Convert an SharingItem to an array of NSObjects.
NSArray* ConvertSharingItemToNS(const SharingItem& item) {
NSMutableArray* result = [NSMutableArray array];
if (item.texts) {
for (const std::string& str : *item.texts)
[result addObject:base::SysUTF8ToNSString(str)];
}
if (item.file_paths) {
for (const base::FilePath& path : *item.file_paths)
[result addObject:base::mac::FilePathToNSURL(path)];
}
if (item.urls) {
for (const GURL& url : *item.urls)
[result addObject:net::NSURLWithGURL(url)];
}
return result;
}
2015-09-01 11:48:11 +00:00
} // namespace
// This class stores a base::WeakPtr<electron::ElectronMenuModel> as an
// Objective-C object, which allows it to be stored in the representedObject
// field of an NSMenuItem.
@interface WeakPtrToElectronMenuModelAsNSObject : NSObject
+ (instancetype)weakPtrForModel:(electron::ElectronMenuModel*)model;
+ (electron::ElectronMenuModel*)getFrom:(id)instance;
- (instancetype)initWithModel:(electron::ElectronMenuModel*)model;
- (electron::ElectronMenuModel*)menuModel;
@end
@implementation WeakPtrToElectronMenuModelAsNSObject {
base::WeakPtr<electron::ElectronMenuModel> _model;
}
+ (instancetype)weakPtrForModel:(electron::ElectronMenuModel*)model {
return [[[WeakPtrToElectronMenuModelAsNSObject alloc] initWithModel:model]
autorelease];
}
+ (electron::ElectronMenuModel*)getFrom:(id)instance {
return
[base::mac::ObjCCastStrict<WeakPtrToElectronMenuModelAsNSObject>(instance)
menuModel];
}
- (instancetype)initWithModel:(electron::ElectronMenuModel*)model {
if ((self = [super init])) {
_model = model->GetWeakPtr();
}
return self;
}
- (electron::ElectronMenuModel*)menuModel {
return _model.get();
}
@end
// Menu item is located for ease of removing it from the parent owner
2017-11-21 18:52:24 +00:00
static base::scoped_nsobject<NSMenuItem> recentDocumentsMenuItem_;
2017-11-21 02:07:11 +00:00
// Submenu retained to be swapped back to |recentDocumentsMenuItem_|
2017-11-21 18:52:24 +00:00
static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
@implementation ElectronMenuController
- (electron::ElectronMenuModel*)model {
return model_.get();
}
- (void)setModel:(electron::ElectronMenuModel*)model {
model_ = model->GetWeakPtr();
}
- (instancetype)initWithModel:(electron::ElectronMenuModel*)model
useDefaultAccelerator:(BOOL)use {
if ((self = [super init])) {
model_ = model->GetWeakPtr();
isMenuOpen_ = NO;
useDefaultAccelerator_ = use;
[self menu];
}
return self;
}
- (void)dealloc {
[menu_ setDelegate:nil];
// Close the menu if it is still open. This could happen if a tab gets closed
// while its context menu is still open.
[self cancel];
model_ = nullptr;
[super dealloc];
}
- (void)setCloseCallback:(base::OnceClosure)callback {
closeCallback = std::move(callback);
2017-02-16 18:58:02 +00:00
}
- (void)populateWithModel:(electron::ElectronMenuModel*)model {
if (!menu_)
return;
// Locate & retain the recent documents menu item
if (!recentDocumentsMenuItem_) {
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
std::u16string title = u"Open Recent";
NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title);
recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu]
itemWithTitle:@"Electron"] submenu] itemWithTitle:openTitle] retain]);
}
model_ = model->GetWeakPtr();
[menu_ removeAllItems];
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == electron::ElectronMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu_ atIndex:index];
else
[self addItemToMenu:menu_ atIndex:index fromModel:model];
}
}
- (void)cancel {
if (isMenuOpen_) {
[menu_ cancelTracking];
isMenuOpen_ = NO;
if (model_)
model_->MenuWillClose();
if (!closeCallback.is_null()) {
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
std::move(closeCallback));
}
}
}
// Creates a NSMenu from the given model. If the model has submenus, this can
// be invoked recursively.
- (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model {
NSMenu* menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
if (model->GetTypeAt(index) == electron::ElectronMenuModel::TYPE_SEPARATOR)
[self addSeparatorToMenu:menu atIndex:index];
else
[self addItemToMenu:menu atIndex:index fromModel:model];
}
return menu;
}
// Adds a separator item at the given index. As the separator doesn't need
// anything from the model, this method doesn't need the model index as the
// other method below does.
2018-04-20 18:47:04 +00:00
- (void)addSeparatorToMenu:(NSMenu*)menu atIndex:(int)index {
NSMenuItem* separator = [NSMenuItem separatorItem];
[menu insertItem:separator atIndex:index];
}
2017-11-21 02:07:11 +00:00
// Empties the source menu items to the destination.
2018-04-20 18:47:04 +00:00
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
const NSInteger count = [source numberOfItems];
for (NSInteger index = 0; index < count; index++) {
NSMenuItem* removedItem = [[[source itemAtIndex:0] retain] autorelease];
[source removeItemAtIndex:0];
[destination addItem:removedItem];
}
}
2017-11-21 02:07:11 +00:00
// Replaces the item's submenu instance with the singleton recent documents
// menu. Previously replaced menu items will be recovered.
- (void)replaceSubmenuShowingRecentDocuments:(NSMenuItem*)item {
NSMenu* recentDocumentsMenu =
[[[recentDocumentsMenuItem_ submenu] retain] autorelease];
// Remove menu items in recent documents back to swap menu
2018-04-20 18:47:04 +00:00
[self moveMenuItems:recentDocumentsMenu to:recentDocumentsMenuSwap_];
// Swap back the submenu
2017-11-21 02:07:11 +00:00
[recentDocumentsMenuItem_ setSubmenu:recentDocumentsMenuSwap_];
// Retain the item's submenu for a future recovery
2017-11-21 18:52:24 +00:00
recentDocumentsMenuSwap_.reset([[item submenu] retain]);
// Repopulate with items from the submenu to be replaced
2018-04-20 18:47:04 +00:00
[self moveMenuItems:recentDocumentsMenuSwap_ to:recentDocumentsMenu];
2017-11-29 03:38:07 +00:00
// Update the submenu's title
[recentDocumentsMenu setTitle:[recentDocumentsMenuSwap_ title]];
// Replace submenu
[item setSubmenu:recentDocumentsMenu];
DCHECK_EQ([item action], @selector(submenuAction:));
DCHECK_EQ([item target], recentDocumentsMenu);
// Remember the new menu item that carries the recent documents menu
2017-11-21 18:52:24 +00:00
recentDocumentsMenuItem_.reset([item retain]);
}
// Fill the menu with Share Menu items.
- (NSMenu*)createShareMenuForItem:(const SharingItem&)item {
NSArray* items = ConvertSharingItemToNS(item);
if ([items count] == 0)
return MakeEmptySubmenu();
base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] init]);
NSArray* services = [NSSharingService sharingServicesForItems:items];
for (NSSharingService* service in services)
[menu addItem:[self menuItemForService:service withItems:items]];
return menu.autorelease();
}
// Creates a menu item that calls |service| when invoked.
- (NSMenuItem*)menuItemForService:(NSSharingService*)service
withItems:(NSArray*)items {
base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
initWithTitle:service.menuItemTitle
action:@selector(performShare:)
keyEquivalent:@""]);
[item setTarget:self];
[item setImage:service.image];
[item setRepresentedObject:@{@"service" : service, @"items" : items}];
return item.autorelease();
}
- (base::scoped_nsobject<NSMenuItem>)
makeMenuItemForIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model {
std::u16string label16 = model->GetLabelAt(index);
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
2018-04-20 18:47:04 +00:00
base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
initWithTitle:label
action:@selector(itemSelected:)
keyEquivalent:@""]);
// If the menu item has an icon, set it.
ui::ImageModel icon = model->GetIconAt(index);
if (icon.IsImage())
[item setImage:icon.GetImage().ToNSImage()];
std::u16string toolTip = model->GetToolTipAt(index);
[item setToolTip:base::SysUTF16ToNSString(toolTip)];
std::u16string role = model->GetRoleAt(index);
electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index);
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
if (role == u"services") {
std::u16string title = u"Services";
NSString* label = l10n_util::FixUpWindowsStyleLabel(title);
[item setTarget:nil];
[item setAction:nil];
NSMenu* submenu = [[[NSMenu alloc] initWithTitle:label] autorelease];
[item setSubmenu:submenu];
[NSApp setServicesMenu:submenu];
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
} else if (role == u"sharemenu") {
SharingItem sharing_item;
model->GetSharingItemAt(index, &sharing_item);
[item setTarget:nil];
[item setAction:nil];
[item setSubmenu:[self createShareMenuForItem:sharing_item]];
} else if (type == electron::ElectronMenuModel::TYPE_SUBMENU &&
model->IsVisibleAt(index)) {
// We need to specifically check that the submenu top-level item has been
// enabled as it's not validated by validateUserInterfaceItem
if (!model->IsEnabledAt(index))
[item setEnabled:NO];
// Recursively build a submenu from the sub-model at this index.
[item setTarget:nil];
[item setAction:nil];
2018-04-20 18:47:04 +00:00
electron::ElectronMenuModel* submenuModel =
static_cast<electron::ElectronMenuModel*>(
model->GetSubmenuModelAt(index));
NSMenu* submenu = MenuHasVisibleItems(submenuModel)
? [self menuFromModel:submenuModel]
: MakeEmptySubmenu();
[submenu setTitle:[item title]];
[item setSubmenu:submenu];
2015-09-01 11:48:11 +00:00
// Set submenu's role.
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
if ((role == u"window" || role == u"windowmenu") && [submenu numberOfItems])
[NSApp setWindowsMenu:submenu];
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
else if (role == u"help")
[NSApp setHelpMenu:submenu];
chore: bump chromium to 92.0.4488.0 (master) (#28676) * chore: bump chromium in DEPS to 92.0.4478.0 * chore: update chromium patches * chore: update v8 patches * fix: add scale parameter to LookupIconFromFilepath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2748317 Follow up: https://github.com/electron/electron/issues/28678 * build: depend on gtkprint config for gtk_util.h Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2824022 * build: add missing print_job_constants header Refs: unknown * chore: bump chromium in DEPS to 92.0.4479.0 * update patches * chore: bump chromium in DEPS to 92.0.4480.0 * chore: bump chromium in DEPS to 92.0.4481.0 * chore: bump chromium in DEPS to 92.0.4482.2 * chore: bump chromium in DEPS to 92.0.4483.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4484.0 * chore: bump chromium in DEPS to 92.0.4485.0 * fix patches * update patches * 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") https://chromium-review.googlesource.com/c/chromium/src/+/2810414 * 2781233: NotificationService: Plumb document_url for non-persistent notifications. https://chromium-review.googlesource.com/c/chromium/src/+/2781233 * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * 2836669: Refactor GTK build target and dependencies https://chromium-review.googlesource.com/c/chromium/src/+/2836669 * chore: bump chromium in DEPS to 92.0.4486.0 * update patches * fix DecrementCapturerCount patch * explicitly include badging.mojom.h * include ui/gtk/gtk_ui_factory.h for BuildGtkUi() * fixup! 2810414: [LSC] Add PRESUBMIT check for ASCIIToUTF16("...") and UTF8ToUTF16("...") * iwyu fix for base::size * iwyu for TRACE_EVENT0 * 2799631: Use structured interface for DevTools messages https://chromium-review.googlesource.com/c/chromium/src/+/2799631 * 2801573: Convert enum to enum class for Widget::InitParams::Activatable https://chromium-review.googlesource.com/c/chromium/src/+/2801573 * 2805764: Add ContentBrowserClient support for service worker-scoped binders https://chromium-review.googlesource.com/c/chromium/src/+/2805764 * fixup! 2799631: Use structured interface for DevTools messages * fixup! 2805764: Add ContentBrowserClient support for service worker-scoped binders * oops, use of linux_ui after std::move * fix devtools message handling for null params * disable node test parallel/test-debug-args https://chromium-review.googlesource.com/c/v8/v8/+/2843348 * fix gn check * chore: bump chromium in DEPS to 92.0.4487.0 * chore: update patches * chore: bump chromium in DEPS to 92.0.4488.0 * update patches * Remove vpython use from Chromium DEPS file https://chromium-review.googlesource.com/c/chromium/src/+/2810121 * Partial revert "workaround: disable CFG longjmp protection for Windows on Arm" https://chromium-review.googlesource.com/c/chromium/src/+/2788210 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-04-27 21:27:34 +00:00
else if (role == u"recentdocuments")
[self replaceSubmenuShowingRecentDocuments:item];
} else {
// The MenuModel works on indexes so we can't just set the command id as the
// tag like we do in other menus. Also set the represented object to be
// the model so hierarchical menus check the correct index in the correct
// model. Setting the target to |self| allows this class to participate
// in validation of the menu items.
[item setTag:index];
[item setRepresentedObject:[WeakPtrToElectronMenuModelAsNSObject
weakPtrForModel:model]];
ui::Accelerator accelerator;
2018-04-20 18:47:04 +00:00
if (model->GetAcceleratorAtWithParams(index, useDefaultAccelerator_,
&accelerator)) {
// Note that we are not using Chromium's
// GetKeyEquivalentAndModifierMaskFromAccelerator API,
// because it will convert Shift+Character to ShiftedCharacter, for
// example Shift+/ would be converted to ?, which is against macOS HIG.
// See also https://github.com/electron/electron/issues/21790.
NSUInteger modifier_mask = 0;
if (accelerator.IsCtrlDown())
modifier_mask |= NSEventModifierFlagControl;
if (accelerator.IsAltDown())
modifier_mask |= NSEventModifierFlagOption;
if (accelerator.IsCmdDown())
modifier_mask |= NSEventModifierFlagCommand;
unichar character;
if (accelerator.shifted_char) {
// When a shifted char is explicitly specified, for example Ctrl+Plus,
// use the shifted char directly.
character = static_cast<unichar>(*accelerator.shifted_char);
} else {
// Otherwise use the unshifted combinations, for example Ctrl+Shift+=.
if (accelerator.IsShiftDown())
modifier_mask |= NSEventModifierFlagShift;
ui::MacKeyCodeForWindowsKeyCode(accelerator.key_code(), modifier_mask,
nullptr, &character);
}
[item setKeyEquivalent:[NSString stringWithFormat:@"%C", character]];
[item setKeyEquivalentModifierMask:modifier_mask];
}
2015-09-01 11:48:11 +00:00
[(id)item
setAllowsKeyEquivalentWhenHidden:(model->WorksWhenHiddenAt(index))];
2015-09-01 11:48:11 +00:00
// Set menu item's role.
2016-08-08 17:09:45 +00:00
[item setTarget:self];
if (!role.empty()) {
2015-09-01 11:48:11 +00:00
for (const Role& pair : kRolesMap) {
if (role == base::ASCIIToUTF16(pair.role)) {
2016-08-08 17:09:45 +00:00
[item setTarget:nil];
2015-09-01 11:48:11 +00:00
[item setAction:pair.selector];
break;
}
}
}
}
return item;
}
// Adds an item or a hierarchical menu to the item at the |index|,
// associated with the entry in the model identified by |modelIndex|.
- (void)addItemToMenu:(NSMenu*)menu
atIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model {
[menu insertItem:[self makeMenuItemForIndex:index fromModel:model]
atIndex:index];
}
// Called before the menu is to be displayed to update the state (enabled,
// radio, etc) of each item in the menu.
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item {
SEL action = [item action];
if (action == @selector(performShare:))
return YES;
if (action != @selector(itemSelected:))
return NO;
NSInteger modelIndex = [item tag];
electron::ElectronMenuModel* model = [WeakPtrToElectronMenuModelAsNSObject
getFrom:[(id)item representedObject]];
DCHECK(model);
if (model) {
BOOL checked = model->IsItemCheckedAt(modelIndex);
DCHECK([(id)item isKindOfClass:[NSMenuItem class]]);
[(id)item setState:(checked ? NSOnState : NSOffState)];
[(id)item setHidden:(!model->IsVisibleAt(modelIndex))];
return model->IsEnabledAt(modelIndex);
}
return NO;
}
// Called when the user chooses a particular menu item. |sender| is the menu
// item chosen.
- (void)itemSelected:(id)sender {
NSInteger modelIndex = [sender tag];
2018-04-20 18:47:04 +00:00
electron::ElectronMenuModel* model =
[WeakPtrToElectronMenuModelAsNSObject getFrom:[sender representedObject]];
DCHECK(model);
if (model) {
NSEvent* event = [NSApp currentEvent];
model->ActivatedAt(modelIndex, ui::EventFlagsFromNSEventWithModifiers(
event, [event modifierFlags]));
}
}
// Performs the share action using the sharing service represented by |sender|.
- (void)performShare:(NSMenuItem*)sender {
NSDictionary* object =
base::mac::ObjCCastStrict<NSDictionary>([sender representedObject]);
NSSharingService* service =
base::mac::ObjCCastStrict<NSSharingService>(object[@"service"]);
NSArray* items = base::mac::ObjCCastStrict<NSArray>(object[@"items"]);
[service setDelegate:self];
[service performWithItems:items];
}
- (NSMenu*)menu {
2014-11-16 13:06:16 +00:00
if (menu_)
return menu_.get();
if (model_ && model_->GetSharingItem()) {
NSMenu* menu = [self createShareMenuForItem:*model_->GetSharingItem()];
menu_.reset([menu retain]);
} else {
menu_.reset([[NSMenu alloc] initWithTitle:@""]);
if (model_)
[self populateWithModel:model_.get()];
}
2014-11-16 13:06:16 +00:00
[menu_ setDelegate:self];
return menu_.get();
}
- (BOOL)isMenuOpen {
return isMenuOpen_;
}
- (void)menuWillOpen:(NSMenu*)menu {
isMenuOpen_ = YES;
if (model_)
model_->MenuWillShow();
}
- (void)menuDidClose:(NSMenu*)menu {
if (isMenuOpen_) {
isMenuOpen_ = NO;
if (model_)
model_->MenuWillClose();
2018-04-20 18:47:04 +00:00
// Post async task so that itemSelected runs before the close callback
// deletes the controller from the map which deallocates it
2018-02-25 22:19:40 +00:00
if (!closeCallback.is_null()) {
chore: bump chromium to 103.0.5046.0 (main) (#33906) * chore: bump chromium in DEPS to 103.0.5020.0 * chore: bump chromium in DEPS to 103.0.5022.0 * chore: bump chromium in DEPS to 103.0.5024.0 * chore: update patches * 3587410: [Printing] Remove JobEventDetails Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587410 * chore: bump chromium in DEPS to 103.0.5026.0 * chore: update patches * 3577218: WebUI: Delete webui_resources.grd and related GN targets. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3577218 * chore: bump chromium in DEPS to 103.0.5028.0 * chore: update patches * 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3579297 * 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3581708 * chore: fix authorization flags lint error * 3583363: Remove net wrappers around base/strings/escape.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * fixup! 3560622: serial: Add SerialPort.forget() method Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3560622 * 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem" Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3587589 * 3584006: Remove IsRenderViewLive from content public Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3584006 * 3596174: [api] Remove APIs for resurrecting finalizers Ref: https://chromium-review.googlesource.com/c/v8/v8/+/3596174 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: bump chromium in DEPS to 103.0.5030.0 * chore: update patches * chore: bump chromium in DEPS to 103.0.5032.0 * chore: bump chromium in DEPS to 103.0.5034.0 * chore: bump chromium in DEPS to 103.0.5036.0 * chore: update patches * 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3586363 * 3593199: Remove content::PermissionType references and replace them with blink::PermissionType Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3593199 * 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3368244 * chore: lint * chore: bump chromium in DEPS to 103.0.5038.0 * chore: update patches * fixup! 3560622: serial: Add SerialPort.forget() method * 3606495: mac screen capture: add metric Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3606495 * chore: bump chromium in DEPS to 103.0.5040.0 * chore: update patches * 3590840: Add IPs to DnsOverHttpsServerConfig https://chromium-review.googlesource.com/c/chromium/src/+/3590840 * stub functions for ElectronSerialDelegate and SerialChooserController to fix link * 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h! Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3347944 * fixup! 3566412: [base] Remove base/android dependency on post_task.h and off… e3ea3e1 …icially remove post_task.h! * chore: update process_singleton patches for content::GetIOThreadTaskRunner({}) Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | https://chromium-review.googlesource.com/c/chromium/src/+/2015655 * chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo * chore: migrate Linux/Windows methods off of post_task.h Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3566412 * 64908: Stop building legacy SwiftShader GL in Chromium https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908 * 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3573245 * chore: bump chromium in DEPS to 103.0.5042.0 * chore: update patches * 3571804: [api] Advance API deprecation for V8 version v10.2 https://chromium-review.googlesource.com/c/v8/v8/+/3571804 * fixup! 3571804: [api] Advance API deprecation for V8 version v10.2 * build: fix run-clang-format extension matching * lint * fix windows build * how is clang-format still not working for me * chore: update patches * 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient. https://chromium-review.googlesource.com/c/chromium/src/+/3623985 * no need to implement WillProvidePublicFirstPartySets; the default is false * 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.* https://chromium-review.googlesource.com/c/chromium/src/+/3601036 * 3583363: Remove net wrappers around base/strings/escape.h https://chromium-review.googlesource.com/c/chromium/src/+/3583363 * lint * chore: bump chromium in DEPS to 103.0.5044.0 * fix conflicts * chore: update patches * upgrade nan * pin version of nan in tests * replace my hacky deprecated override fix with the fix from upstream * revert runtime dcheck in v8 * pin nan version at root too * refactor: tell gyp to use c++17 when building with our node * Revert "refactor: tell gyp to use c++17 when building with our node" This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192. * Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192. This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348. * disable sequential/test-cpu-prof-kill for now * also sequential/test-diagnostic-dir-cpu-prof Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: VerteDinde <vertedinde@electronjs.org> Co-authored-by: Jeremy Rose <japthorp@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-05-17 16:48:40 +00:00
content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
std::move(closeCallback));
2018-02-25 22:19:40 +00:00
}
}
}
// NSSharingServiceDelegate
- (NSWindow*)sharingService:(NSSharingService*)service
sourceWindowForShareItems:(NSArray*)items
sharingContentScope:(NSSharingContentScope*)scope {
// Return the current active window.
const auto& list = electron::WindowList::GetWindows();
for (electron::NativeWindow* window : list) {
if (window->IsFocused())
return window->GetNativeWindow().GetNativeNSWindow();
}
return nil;
}
@end