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/mac/me2me_preference_pane.h" | 5 #import "remoting/host/mac/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> |
11 #import <PreferencePanes/PreferencePanes.h> | 11 #import <PreferencePanes/PreferencePanes.h> |
12 #import <SecurityInterface/SFAuthorizationView.h> | 12 #import <SecurityInterface/SFAuthorizationView.h> |
13 #include <stddef.h> | 13 #include <stddef.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <unistd.h> | 15 #include <unistd.h> |
16 | 16 |
17 #include <fstream> | 17 #include <fstream> |
18 | 18 |
| 19 #include "base/mac/mac_logging.h" |
19 #include "base/mac/scoped_launch_data.h" | 20 #include "base/mac/scoped_launch_data.h" |
20 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
21 #include "base/posix/eintr_wrapper.h" | 22 #include "base/posix/eintr_wrapper.h" |
22 #include "remoting/host/constants_mac.h" | 23 #include "remoting/host/constants_mac.h" |
23 #include "remoting/host/host_config.h" | 24 #include "remoting/host/host_config.h" |
24 #include "remoting/host/pin_hash.h" | 25 #include "remoting/host/pin_hash.h" |
25 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h" | 26 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h" |
26 #import "remoting/host/mac/me2me_preference_pane_disable.h" | 27 #import "remoting/host/mac/me2me_preference_pane_disable.h" |
27 #include "third_party/jsoncpp/source/include/json/reader.h" | 28 #include "third_party/jsoncpp/source/include/json/reader.h" |
28 #include "third_party/jsoncpp/source/include/json/writer.h" | 29 #include "third_party/jsoncpp/source/include/json/writer.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 pid_t pid; | 515 pid_t pid; |
515 OSStatus status = base::mac::ExecuteWithPrivilegesAndGetPID( | 516 OSStatus status = base::mac::ExecuteWithPrivilegesAndGetPID( |
516 authorization, | 517 authorization, |
517 remoting::kHostHelperScriptPath, | 518 remoting::kHostHelperScriptPath, |
518 kAuthorizationFlagDefaults, | 519 kAuthorizationFlagDefaults, |
519 arguments, | 520 arguments, |
520 &pipe, | 521 &pipe, |
521 &pid); | 522 &pid); |
522 if (status != errAuthorizationSuccess) { | 523 if (status != errAuthorizationSuccess) { |
523 NSLog(@"AuthorizationExecuteWithPrivileges: %s (%d)", | 524 NSLog(@"AuthorizationExecuteWithPrivileges: %s (%d)", |
524 GetMacOSStatusErrorString(status), static_cast<int>(status)); | 525 logging::DescriptionFromOSStatus(status).c_str(), |
| 526 static_cast<int>(status)); |
525 return NO; | 527 return NO; |
526 } | 528 } |
527 if (pid == -1) { | 529 if (pid == -1) { |
528 NSLog(@"Failed to get child PID"); | 530 NSLog(@"Failed to get child PID"); |
529 if (pipe) | 531 if (pipe) |
530 fclose(pipe); | 532 fclose(pipe); |
531 | 533 |
532 return NO; | 534 return NO; |
533 } | 535 } |
534 if (!pipe) { | 536 if (!pipe) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; | 711 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; |
710 [task setLaunchPath:command]; | 712 [task setLaunchPath:command]; |
711 [task setArguments:arguments]; | 713 [task setArguments:arguments]; |
712 [task setStandardInput:[NSPipe pipe]]; | 714 [task setStandardInput:[NSPipe pipe]]; |
713 [task launch]; | 715 [task launch]; |
714 [task release]; | 716 [task release]; |
715 [NSApp terminate:nil]; | 717 [NSApp terminate:nil]; |
716 } | 718 } |
717 | 719 |
718 @end | 720 @end |
OLD | NEW |