fix: properly register custom url evt handling (#20518)
This commit is contained in:
parent
ec2c1db0e4
commit
812de5d3bf
5 changed files with 9 additions and 1 deletions
|
@ -537,6 +537,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
|
||||||
void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
|
void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
InitializeEmptyApplicationMenu();
|
InitializeEmptyApplicationMenu();
|
||||||
|
RegisterURLHandler();
|
||||||
#endif
|
#endif
|
||||||
media::SetLocalizedStringProvider(MediaStringProvider);
|
media::SetLocalizedStringProvider(MediaStringProvider);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void FreeAppDelegate();
|
void FreeAppDelegate();
|
||||||
|
void RegisterURLHandler();
|
||||||
void InitializeEmptyApplicationMenu();
|
void InitializeEmptyApplicationMenu();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "shell/browser/atom_browser_main_parts.h"
|
#include "shell/browser/atom_browser_main_parts.h"
|
||||||
|
|
||||||
#include "shell/browser/atom_paths.h"
|
#include "shell/browser/atom_paths.h"
|
||||||
|
#import "shell/browser/mac/atom_application.h"
|
||||||
#include "shell/browser/mac/atom_application_delegate.h"
|
#include "shell/browser/mac/atom_application_delegate.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
@ -72,6 +73,10 @@ void AtomBrowserMainParts::FreeAppDelegate() {
|
||||||
[NSApp setDelegate:nil];
|
[NSApp setDelegate:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtomBrowserMainParts::RegisterURLHandler() {
|
||||||
|
[[AtomApplication sharedApplication] registerURLHandler];
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserMainParts::InitializeEmptyApplicationMenu() {
|
void AtomBrowserMainParts::InitializeEmptyApplicationMenu() {
|
||||||
base::scoped_nsobject<NSMenu> main_menu = BuildEmptyMainMenu();
|
base::scoped_nsobject<NSMenu> main_menu = BuildEmptyMainMenu();
|
||||||
[[NSApplication sharedApplication] setMainMenu:main_menu];
|
[[NSApplication sharedApplication] setMainMenu:main_menu];
|
||||||
|
|
|
@ -97,6 +97,7 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) {
|
||||||
+ (AtomApplication*)sharedApplication;
|
+ (AtomApplication*)sharedApplication;
|
||||||
|
|
||||||
- (void)setShutdownHandler:(base::Callback<bool()>)handler;
|
- (void)setShutdownHandler:(base::Callback<bool()>)handler;
|
||||||
|
- (void)registerURLHandler;
|
||||||
|
|
||||||
// CrAppProtocol:
|
// CrAppProtocol:
|
||||||
- (BOOL)isHandlingSendEvent;
|
- (BOOL)isHandlingSendEvent;
|
||||||
|
|
|
@ -153,7 +153,7 @@ inline void dispatch_sync_main(dispatch_block_t block) {
|
||||||
[userActivity setNeedsSave:YES];
|
[userActivity setNeedsSave:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)registerURLHandler {
|
||||||
[[NSAppleEventManager sharedAppleEventManager]
|
[[NSAppleEventManager sharedAppleEventManager]
|
||||||
setEventHandler:self
|
setEventHandler:self
|
||||||
andSelector:@selector(handleURLEvent:withReplyEvent:)
|
andSelector:@selector(handleURLEvent:withReplyEvent:)
|
||||||
|
|
Loading…
Reference in a new issue