Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: remoting/host/me2me_preference_pane.mm

Issue 10398061: Merge 137292 - Use distributed notifications instead of polling to determine success/failure of the… (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1132/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/host/plugin/daemon_controller_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/me2me_preference_pane.mm
===================================================================
--- remoting/host/me2me_preference_pane.mm (revision 137494)
+++ remoting/host/me2me_preference_pane.mm (working copy)
@@ -28,6 +28,13 @@
namespace {
// The name of the Remoting Host service that is registered with launchd.
#define kServiceName "org.chromium.chromoting"
+
+// Use separate named notifications for success and failure because sandboxed
+// components can't include a dictionary when sending distributed notifications.
+// The preferences panel is not yet sandboxed, but err on the side of caution.
+#define kUpdateSucceededNotificationName kServiceName ".update_succeeded"
+#define kUpdateFailedNotificationName kServiceName ".update_failed"
+
#define kConfigDir "/Library/PrivilegedHelperTools/"
// This helper script is executed as root. It is passed a command-line option
@@ -103,6 +110,9 @@
[service_status_timer_ invalidate];
[service_status_timer_ release];
service_status_timer_ = nil;
+ if (have_new_config_) {
+ [self notifyPlugin: kUpdateFailedNotificationName];
+ }
}
- (void)onApply:(id)sender {
@@ -291,6 +301,10 @@
} else {
[self sendJobControlMessage:LAUNCH_KEY_STARTJOB];
}
+
+ // Broadcast a distributed notification to inform the plugin that the
+ // configuration has been applied.
+ [self notifyPlugin: kUpdateSucceededNotificationName];
}
- (BOOL)runHelperAsRootWithCommand:(const char*)command
@@ -400,4 +414,13 @@
return YES;
}
+- (void)notifyPlugin:(const char*)message {
+ NSDistributedNotificationCenter* center =
+ [NSDistributedNotificationCenter defaultCenter];
+ NSString* name = [NSString stringWithUTF8String:message];
+ [center postNotificationName:name
+ object:nil
+ userInfo:nil];
+}
+
@end
« no previous file with comments | « no previous file | remoting/host/plugin/daemon_controller_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698