Save the activity on the application instance to ensure we hold a reference. Activities that enable search need to persist.
This commit is contained in:
parent
a5a2e20449
commit
42768bcc2b
3 changed files with 16 additions and 1 deletions
|
@ -89,7 +89,7 @@ void Browser::SetAppUserModelID(const base::string16& name) {
|
||||||
|
|
||||||
void Browser::SetUserActivity(const std::string& type, const std::map<std::string, std::string>& user_info) {
|
void Browser::SetUserActivity(const std::string& type, const std::map<std::string, std::string>& user_info) {
|
||||||
NSString* type_ns = [NSString stringWithUTF8String:type.c_str()];
|
NSString* type_ns = [NSString stringWithUTF8String:type.c_str()];
|
||||||
NSUserActivity *user_activity = [[NSUserActivity alloc] initWithActivityType:type_ns];
|
NSUserActivity* user_activity = [[NSUserActivity alloc] initWithActivityType:type_ns];
|
||||||
|
|
||||||
NSMutableArray* user_info_args = [[NSMutableArray alloc] init];
|
NSMutableArray* user_info_args = [[NSMutableArray alloc] init];
|
||||||
for (auto const &pair : user_info) {
|
for (auto const &pair : user_info) {
|
||||||
|
@ -102,6 +102,8 @@ void Browser::SetUserActivity(const std::string& type, const std::map<std::strin
|
||||||
|
|
||||||
user_activity.userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:user_info_args, nil];
|
user_activity.userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:user_info_args, nil];
|
||||||
[user_activity becomeCurrent];
|
[user_activity becomeCurrent];
|
||||||
|
|
||||||
|
[[AtomApplication sharedApplication] setUserActivity:user_activity];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Browser::GetExecutableFileVersion() const {
|
std::string Browser::GetExecutableFileVersion() const {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
CrAppControlProtocol> {
|
CrAppControlProtocol> {
|
||||||
@private
|
@private
|
||||||
BOOL handlingSendEvent_;
|
BOOL handlingSendEvent_;
|
||||||
|
NSUserActivity* currentActivity_;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (AtomApplication*)sharedApplication;
|
+ (AtomApplication*)sharedApplication;
|
||||||
|
@ -18,4 +19,8 @@
|
||||||
// CrAppControlProtocol:
|
// CrAppControlProtocol:
|
||||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
||||||
|
|
||||||
|
- (NSUserActivity*)getCurrentActivity;
|
||||||
|
|
||||||
|
- (void)setCurrentActivity:(NSUserActivity*)userActivity;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -28,6 +28,14 @@
|
||||||
handlingSendEvent_ = handlingSendEvent;
|
handlingSendEvent_ = handlingSendEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setCurrentActivity:(NSUserActivity*)userActivity {
|
||||||
|
currentActivity_ = userActivity;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSUserActivity*)getCurrentActivity {
|
||||||
|
return currentActivity_;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
[[NSAppleEventManager sharedAppleEventManager]
|
[[NSAppleEventManager sharedAppleEventManager]
|
||||||
setEventHandler:self
|
setEventHandler:self
|
||||||
|
|
Loading…
Reference in a new issue