Chromium Code Reviews| Index: remoting/host/me2me_preference_pane.mm |
| diff --git a/remoting/host/me2me_preference_pane.mm b/remoting/host/me2me_preference_pane.mm |
| index d092983ba081d82ff257c5f6970fa9519e77be2f..90e34a5d3831337baabc04ec6a5189ecbd0c0f49 100644 |
| --- a/remoting/host/me2me_preference_pane.mm |
| +++ b/remoting/host/me2me_preference_pane.mm |
| @@ -28,6 +28,8 @@ |
| namespace { |
| // The name of the Remoting Host service that is registered with launchd. |
| #define kServiceName "org.chromium.chromoting" |
| + |
| +#define kUpdateCompleteNotificationName kServiceName ".update_complete" |
| #define kConfigDir "/Library/PrivilegedHelperTools/" |
| // This helper script is executed as root. It is passed a command-line option |
| @@ -103,6 +105,9 @@ bool IsPinValid(const std::string& pin, const std::string& host_id, |
| [service_status_timer_ invalidate]; |
| [service_status_timer_ release]; |
| service_status_timer_ = nil; |
| + if (have_new_config_) { |
| + [self notifyPlugin: @"CANCEL"]; |
| + } |
| } |
| - (void)onApply:(id)sender { |
| @@ -291,6 +296,10 @@ bool IsPinValid(const std::string& pin, const std::string& host_id, |
| } else { |
| [self sendJobControlMessage:LAUNCH_KEY_STARTJOB]; |
| } |
| + |
| + // Broadcast a distributed notification to inform the plugin that the |
| + // configuration has been applied. |
| + [self notifyPlugin: @"OK"]; |
| } |
| - (BOOL)runHelperAsRootWithCommand:(const char*)command |
| @@ -400,4 +409,17 @@ bool IsPinValid(const std::string& pin, const std::string& host_id, |
| return YES; |
| } |
| +- (void)notifyPlugin:(NSString*)result { |
| + NSDistributedNotificationCenter* center = |
| + [NSDistributedNotificationCenter defaultCenter]; |
| + NSString* name = |
| + [[NSString alloc] initWithUTF8String:kUpdateCompleteNotificationName]; |
|
Lambros
2012/05/15 18:55:35
nit: stringWithUTF8String might be easier (and doe
Jamie
2012/05/15 20:53:50
Thanks, I wasn't aware of that.
|
| + NSDictionary* result_dictionary = |
| + [NSDictionary dictionaryWithObject:result |
| + forKey:@"result"]; |
| + [center postNotificationName:name |
| + object:nil |
| + userInfo:result_dictionary]; |
| +} |
| + |
| @end |