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

Side by Side Diff: remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm

Issue 1778763002: Prepare remoting/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp89_107_base4
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | remoting/host/mac/me2me_preference_pane.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/authorization_util.h"
9 #include "base/mac/scoped_authorizationref.h" 10 #include "base/mac/scoped_authorizationref.h"
10 #include "remoting/host/constants_mac.h" 11 #include "remoting/host/constants_mac.h"
11 12
12 13
13 void logOutput(FILE* pipe) { 14 void logOutput(FILE* pipe) {
14 char readBuffer[128]; 15 char readBuffer[128];
15 for (;;) { 16 for (;;) {
16 long bytesRead = read(fileno(pipe), readBuffer, sizeof(readBuffer) - 1); 17 long bytesRead = read(fileno(pipe), readBuffer, sizeof(readBuffer) - 1);
17 if (bytesRead < 1) 18 if (bytesRead < 1)
18 break; 19 break;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 } 81 }
81 82
82 - (void)sudoCommand:(const char*)cmd 83 - (void)sudoCommand:(const char*)cmd
83 withArguments:(const char**)args 84 withArguments:(const char**)args
84 usingAuth:(AuthorizationRef)authRef { 85 usingAuth:(AuthorizationRef)authRef {
85 NSArray* arg_array = convertToNSArray(args); 86 NSArray* arg_array = convertToNSArray(args);
86 NSLog(@"Executing (as Admin): %s %@", cmd, 87 NSLog(@"Executing (as Admin): %s %@", cmd,
87 [arg_array componentsJoinedByString:@" "]); 88 [arg_array componentsJoinedByString:@" "]);
88 FILE* pipe = nullptr; 89 FILE* pipe = nullptr;
89 OSStatus status; 90 OSStatus status = base::mac::ExecuteWithPrivilegesAndGetPID(
90 status = AuthorizationExecuteWithPrivileges(authRef, cmd, 91 authRef, cmd, kAuthorizationFlagDefaults, args, &pipe, nullptr);
91 kAuthorizationFlagDefaults,
92 (char* const*)args,
93 &pipe);
94 92
95 if (status == errAuthorizationToolExecuteFailure) { 93 if (status == errAuthorizationToolExecuteFailure) {
96 NSLog(@"Error errAuthorizationToolExecuteFailure"); 94 NSLog(@"Error errAuthorizationToolExecuteFailure");
97 } else if (status != errAuthorizationSuccess) { 95 } else if (status != errAuthorizationSuccess) {
98 NSLog(@"Error while executing %s. Status=%d", 96 NSLog(@"Error while executing %s. Status=%d",
99 cmd, static_cast<int>(status)); 97 cmd, static_cast<int>(status));
100 } else { 98 } else {
101 logOutput(pipe); 99 logOutput(pipe);
102 } 100 }
103 101
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 status = AuthorizationCopyRights(authRef, &rights, nullptr, flags, nullptr); 168 status = AuthorizationCopyRights(authRef, &rights, nullptr, flags, nullptr);
171 if (status == errAuthorizationSuccess) { 169 if (status == errAuthorizationSuccess) {
172 RemotingUninstaller* uninstaller = 170 RemotingUninstaller* uninstaller =
173 [[[RemotingUninstaller alloc] init] autorelease]; 171 [[[RemotingUninstaller alloc] init] autorelease];
174 [uninstaller remotingUninstallUsingAuth:authRef]; 172 [uninstaller remotingUninstallUsingAuth:authRef];
175 } 173 }
176 return status; 174 return status;
177 } 175 }
178 176
179 @end 177 @end
OLDNEW
« no previous file with comments | « no previous file | remoting/host/mac/me2me_preference_pane.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698