Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly register custom open-url evt handling #20518

Merged
merged 1 commit into from Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions shell/browser/atom_browser_main_parts.cc
Expand Up @@ -537,6 +537,7 @@ void AtomBrowserMainParts::PreMainMessageLoopStart() {
void AtomBrowserMainParts::PreMainMessageLoopStartCommon() {
#if defined(OS_MACOSX)
InitializeEmptyApplicationMenu();
RegisterURLHandler();
#endif
media::SetLocalizedStringProvider(MediaStringProvider);
}
Expand Down
1 change: 1 addition & 0 deletions shell/browser/atom_browser_main_parts.h
Expand Up @@ -105,6 +105,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {

#if defined(OS_MACOSX)
void FreeAppDelegate();
void RegisterURLHandler();
void InitializeEmptyApplicationMenu();
#endif

Expand Down
5 changes: 5 additions & 0 deletions shell/browser/atom_browser_main_parts_mac.mm
Expand Up @@ -5,6 +5,7 @@
#include "shell/browser/atom_browser_main_parts.h"

#include "shell/browser/atom_paths.h"
#import "shell/browser/mac/atom_application.h"
#include "shell/browser/mac/atom_application_delegate.h"

namespace electron {
Expand Down Expand Up @@ -72,6 +73,10 @@
[NSApp setDelegate:nil];
}

void AtomBrowserMainParts::RegisterURLHandler() {
[[AtomApplication sharedApplication] registerURLHandler];
}

void AtomBrowserMainParts::InitializeEmptyApplicationMenu() {
base::scoped_nsobject<NSMenu> main_menu = BuildEmptyMainMenu();
[[NSApplication sharedApplication] setMainMenu:main_menu];
Expand Down
1 change: 1 addition & 0 deletions shell/browser/mac/atom_application.h
Expand Up @@ -97,6 +97,7 @@ typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) {
+ (AtomApplication*)sharedApplication;

- (void)setShutdownHandler:(base::Callback<bool()>)handler;
- (void)registerURLHandler;

// CrAppProtocol:
- (BOOL)isHandlingSendEvent;
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/mac/atom_application.mm
Expand Up @@ -153,7 +153,7 @@ - (void)userActivityWasContinued:(NSUserActivity*)userActivity {
[userActivity setNeedsSave:YES];
}

- (void)awakeFromNib {
- (void)registerURLHandler {
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(handleURLEvent:withReplyEvent:)
Expand Down