| 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 #include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h" | 5 #include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_authorizationref.h" | 9 #include "base/mac/scoped_authorizationref.h" |
| 10 #include "remoting/host/constants_mac.h" | 10 #include "remoting/host/constants_mac.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 [self sudoDelete:remoting::kLogFileConfigPath usingAuth:authRef]; | 145 [self sudoDelete:remoting::kLogFileConfigPath usingAuth:authRef]; |
| 146 [self sudoDelete:remoting::kNativeMessagingManifestPath usingAuth:authRef]; | 146 [self sudoDelete:remoting::kNativeMessagingManifestPath usingAuth:authRef]; |
| 147 [self sudoDelete:remoting::kBrandedUninstallerPath usingAuth:authRef]; | 147 [self sudoDelete:remoting::kBrandedUninstallerPath usingAuth:authRef]; |
| 148 [self sudoDelete:remoting::kUnbrandedUninstallerPath usingAuth:authRef]; | 148 [self sudoDelete:remoting::kUnbrandedUninstallerPath usingAuth:authRef]; |
| 149 | 149 |
| 150 [self keystoneUnregisterUsingAuth:authRef]; | 150 [self keystoneUnregisterUsingAuth:authRef]; |
| 151 } | 151 } |
| 152 | 152 |
| 153 - (OSStatus)remotingUninstall { | 153 - (OSStatus)remotingUninstall { |
| 154 base::mac::ScopedAuthorizationRef authRef; | 154 base::mac::ScopedAuthorizationRef authRef; |
| 155 OSStatus status = AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment, | 155 OSStatus status = |
| 156 kAuthorizationFlagDefaults, &authRef); | 156 AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment, |
| 157 kAuthorizationFlagDefaults, authRef.get_pointer()); |
| 157 if (status != errAuthorizationSuccess) { | 158 if (status != errAuthorizationSuccess) { |
| 158 [NSException raise:@"AuthorizationCreate Failure" | 159 [NSException raise:@"AuthorizationCreate Failure" |
| 159 format:@"Error during AuthorizationCreate status=%d", | 160 format:@"Error during AuthorizationCreate status=%d", |
| 160 static_cast<int>(status)]; | 161 static_cast<int>(status)]; |
| 161 } | 162 } |
| 162 | 163 |
| 163 AuthorizationItem right = {kAuthorizationRightExecute, 0, nullptr, 0}; | 164 AuthorizationItem right = {kAuthorizationRightExecute, 0, nullptr, 0}; |
| 164 AuthorizationRights rights = {1, &right}; | 165 AuthorizationRights rights = {1, &right}; |
| 165 AuthorizationFlags flags = kAuthorizationFlagDefaults | | 166 AuthorizationFlags flags = kAuthorizationFlagDefaults | |
| 166 kAuthorizationFlagInteractionAllowed | | 167 kAuthorizationFlagInteractionAllowed | |
| 167 kAuthorizationFlagPreAuthorize | | 168 kAuthorizationFlagPreAuthorize | |
| 168 kAuthorizationFlagExtendRights; | 169 kAuthorizationFlagExtendRights; |
| 169 status = AuthorizationCopyRights(authRef, &rights, nullptr, flags, nullptr); | 170 status = AuthorizationCopyRights(authRef, &rights, nullptr, flags, nullptr); |
| 170 if (status == errAuthorizationSuccess) { | 171 if (status == errAuthorizationSuccess) { |
| 171 RemotingUninstaller* uninstaller = | 172 RemotingUninstaller* uninstaller = |
| 172 [[[RemotingUninstaller alloc] init] autorelease]; | 173 [[[RemotingUninstaller alloc] init] autorelease]; |
| 173 [uninstaller remotingUninstallUsingAuth:authRef]; | 174 [uninstaller remotingUninstallUsingAuth:authRef]; |
| 174 } | 175 } |
| 175 return status; | 176 return status; |
| 176 } | 177 } |
| 177 | 178 |
| 178 @end | 179 @end |
| OLD | NEW |