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 ac33b13eb329ad3a275c923e5725bf0d183b85ce..5d8cec82c44c75928aab6beae1307590948e8b59 100644 |
| --- a/remoting/host/me2me_preference_pane.mm |
| +++ b/remoting/host/me2me_preference_pane.mm |
| @@ -35,6 +35,18 @@ namespace { |
| #define kUpdateSucceededNotificationName kServiceName ".update_succeeded" |
| #define kUpdateFailedNotificationName kServiceName ".update_failed" |
| +// This notification (or the UpdateFailed notification) is sent whenever the |
| +// pref-pane is deselected. This is analogous to the user canceling the |
| +// confirm-PIN dialog (or UAC prompt) on Windows. |
| +// If the plugin is expecting an action to occur (such as the user disabling |
| +// the Host service), it should treat this as a signal to stop waiting, and |
| +// assume the action has been canceled by the user. |
| +// Otherwise, the plugin should ignore this notification. The pref-pane does |
| +// not know whether it was launched by the plugin or by the user (in the case |
| +// of disabling remote connections), so it has to send this notification |
| +// regardless. |
| +#define kUserCanceledNotificationName kServiceName ".user_canceled" |
|
Jamie
2012/06/15 22:34:56
Can we call this update_canceled for consistency w
|
| + |
| #define kConfigDir "/Library/PrivilegedHelperTools/" |
| // This helper script is executed as root. It is passed a command-line option |
| @@ -329,6 +341,8 @@ std::string JsonHostConfig::GetSerializedData() const { |
| service_status_timer_ = nil; |
| if (have_new_config_) |
| [self notifyPlugin:kUpdateFailedNotificationName]; |
| + else |
| + [self notifyPlugin:kUserCanceledNotificationName]; |
|
Jamie
2012/06/15 22:34:56
This feels inconsistent. Why send a failed notific
|
| } |
| - (void)applyConfiguration:(id)sender |
| @@ -753,11 +767,12 @@ std::string JsonHostConfig::GetSerializedData() const { |
| NSLog(@"Failed to get path of configuration data."); |
| return; |
| } |
| - if (access(file.c_str(), F_OK) != 0) |
| - return; |
| - |
| - remove(file.c_str()); |
| - [self notifyPlugin:kUpdateFailedNotificationName]; |
| + if (access(file.c_str(), F_OK) != 0) { |
| + [self notifyPlugin:kUserCanceledNotificationName]; |
|
Jamie
2012/06/15 22:34:56
Under what circumstances can this happen? Would it
|
| + } else { |
| + remove(file.c_str()); |
| + [self notifyPlugin:kUpdateFailedNotificationName]; |
| + } |
| } |
| } |