OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "remoting/host/me2me_preference_pane.h" | 5 #import "remoting/host/me2me_preference_pane.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <CommonCrypto/CommonHMAC.h> | 8 #include <CommonCrypto/CommonHMAC.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <launch.h> | 10 #include <launch.h> |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 - (void)willUnselect { | 322 - (void)willUnselect { |
323 NSDistributedNotificationCenter* center = | 323 NSDistributedNotificationCenter* center = |
324 [NSDistributedNotificationCenter defaultCenter]; | 324 [NSDistributedNotificationCenter defaultCenter]; |
325 [center removeObserver:self]; | 325 [center removeObserver:self]; |
326 | 326 |
327 [service_status_timer_ invalidate]; | 327 [service_status_timer_ invalidate]; |
328 [service_status_timer_ release]; | 328 [service_status_timer_ release]; |
329 service_status_timer_ = nil; | 329 service_status_timer_ = nil; |
330 if (have_new_config_) | 330 |
331 [self notifyPlugin:kUpdateFailedNotificationName]; | 331 [self notifyPlugin:kUpdateFailedNotificationName]; |
332 } | 332 } |
333 | 333 |
334 - (void)applyConfiguration:(id)sender | 334 - (void)applyConfiguration:(id)sender |
335 pin:(NSString*)pin { | 335 pin:(NSString*)pin { |
336 if (!have_new_config_) { | 336 if (!have_new_config_) { |
337 // It shouldn't be possible to hit the button if there is no config to | 337 // It shouldn't be possible to hit the button if there is no config to |
338 // apply, but check anyway just in case it happens somehow. | 338 // apply, but check anyway just in case it happens somehow. |
339 return; | 339 return; |
340 } | 340 } |
341 | 341 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // spinning state until System Preferences eventually gets restarted and | 746 // spinning state until System Preferences eventually gets restarted and |
747 // the user visits this pane again. | 747 // the user visits this pane again. |
748 std::string file; | 748 std::string file; |
749 if (!GetTemporaryConfigFilePath(&file)) { | 749 if (!GetTemporaryConfigFilePath(&file)) { |
750 // There's no point in alerting the user here. The same error would | 750 // There's no point in alerting the user here. The same error would |
751 // happen when the pane is eventually restarted, so the user would be | 751 // happen when the pane is eventually restarted, so the user would be |
752 // alerted at that time. | 752 // alerted at that time. |
753 NSLog(@"Failed to get path of configuration data."); | 753 NSLog(@"Failed to get path of configuration data."); |
754 return; | 754 return; |
755 } | 755 } |
756 if (access(file.c_str(), F_OK) != 0) | |
757 return; | |
758 | 756 |
759 remove(file.c_str()); | 757 remove(file.c_str()); |
760 [self notifyPlugin:kUpdateFailedNotificationName]; | 758 [self notifyPlugin:kUpdateFailedNotificationName]; |
761 } | 759 } |
762 } | 760 } |
763 | 761 |
764 - (void)restartSystemPreferences { | 762 - (void)restartSystemPreferences { |
765 NSTask* task = [[NSTask alloc] init]; | 763 NSTask* task = [[NSTask alloc] init]; |
766 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; | 764 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; |
767 [task setLaunchPath:[NSString stringWithUTF8String:kHelperTool]]; | 765 [task setLaunchPath:[NSString stringWithUTF8String:kHelperTool]]; |
768 [task setArguments:arguments]; | 766 [task setArguments:arguments]; |
769 [task setStandardInput:[NSPipe pipe]]; | 767 [task setStandardInput:[NSPipe pipe]]; |
770 [task launch]; | 768 [task launch]; |
771 [task release]; | 769 [task release]; |
772 [NSApp terminate:nil]; | 770 [NSApp terminate:nil]; |
773 } | 771 } |
774 | 772 |
775 @end | 773 @end |
OLD | NEW |