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 "chrome/browser/mac/keystone_glue.h" | 5 #import "chrome/browser/mac/keystone_glue.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/mac/bundle_locations.h" | 16 #include "base/mac/bundle_locations.h" |
| 17 #include "base/mac/mac_logging.h" |
17 #include "base/mac/mac_util.h" | 18 #include "base/mac/mac_util.h" |
18 #include "base/mac/scoped_nsautorelease_pool.h" | 19 #include "base/mac/scoped_nsautorelease_pool.h" |
19 #include "base/mac/scoped_nsexception_enabler.h" | 20 #include "base/mac/scoped_nsexception_enabler.h" |
20 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
21 #include "base/sys_string_conversions.h" | 22 #include "base/sys_string_conversions.h" |
22 #include "base/threading/worker_pool.h" | 23 #include "base/threading/worker_pool.h" |
23 #include "chrome/browser/mac/authorization_util.h" | 24 #include "chrome/browser/mac/authorization_util.h" |
24 #import "chrome/browser/mac/keystone_registration.h" | 25 #import "chrome/browser/mac/keystone_registration.h" |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_version_info.h" | 27 #include "chrome/common/chrome_version_info.h" |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 | 847 |
847 int exit_status; | 848 int exit_status; |
848 OSStatus status = authorization_util::ExecuteWithPrivilegesAndWait( | 849 OSStatus status = authorization_util::ExecuteWithPrivilegesAndWait( |
849 authorization, | 850 authorization, |
850 preflightPathC, | 851 preflightPathC, |
851 kAuthorizationFlagDefaults, | 852 kAuthorizationFlagDefaults, |
852 arguments, | 853 arguments, |
853 NULL, // pipe | 854 NULL, // pipe |
854 &exit_status); | 855 &exit_status); |
855 if (status != errAuthorizationSuccess) { | 856 if (status != errAuthorizationSuccess) { |
856 LOG(ERROR) << "AuthorizationExecuteWithPrivileges preflight: " << status; | 857 OSSTATUS_LOG(ERROR, status) |
| 858 << "AuthorizationExecuteWithPrivileges preflight"; |
857 [self updateStatus:kAutoupdatePromoteFailed version:nil]; | 859 [self updateStatus:kAutoupdatePromoteFailed version:nil]; |
858 return; | 860 return; |
859 } | 861 } |
860 if (exit_status != 0) { | 862 if (exit_status != 0) { |
861 LOG(ERROR) << "keystone_promote_preflight status " << exit_status; | 863 LOG(ERROR) << "keystone_promote_preflight status " << exit_status; |
862 [self updateStatus:kAutoupdatePromoteFailed version:nil]; | 864 [self updateStatus:kAutoupdatePromoteFailed version:nil]; |
863 return; | 865 return; |
864 } | 866 } |
865 | 867 |
866 // Hang on to the AuthorizationRef so that it can be used once promotion is | 868 // Hang on to the AuthorizationRef so that it can be used once promotion is |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 | 935 |
934 int exit_status; | 936 int exit_status; |
935 OSStatus status = authorization_util::ExecuteWithPrivilegesAndWait( | 937 OSStatus status = authorization_util::ExecuteWithPrivilegesAndWait( |
936 authorization_, | 938 authorization_, |
937 toolPathC, | 939 toolPathC, |
938 kAuthorizationFlagDefaults, | 940 kAuthorizationFlagDefaults, |
939 arguments, | 941 arguments, |
940 NULL, // pipe | 942 NULL, // pipe |
941 &exit_status); | 943 &exit_status); |
942 if (status != errAuthorizationSuccess) { | 944 if (status != errAuthorizationSuccess) { |
943 LOG(ERROR) << "AuthorizationExecuteWithPrivileges postflight: " << status; | 945 OSSTATUS_LOG(ERROR, status) |
| 946 << "AuthorizationExecuteWithPrivileges postflight"; |
944 } else if (exit_status != 0) { | 947 } else if (exit_status != 0) { |
945 LOG(ERROR) << "keystone_promote_postflight status " << exit_status; | 948 LOG(ERROR) << "keystone_promote_postflight status " << exit_status; |
946 } | 949 } |
947 | 950 |
948 SEL selector = @selector(changePermissionsForPromotionComplete); | 951 SEL selector = @selector(changePermissionsForPromotionComplete); |
949 [self performSelectorOnMainThread:selector | 952 [self performSelectorOnMainThread:selector |
950 withObject:nil | 953 withObject:nil |
951 waitUntilDone:NO]; | 954 waitUntilDone:NO]; |
952 } | 955 } |
953 | 956 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 return [KeystoneGlue defaultKeystoneGlue] != nil; | 1002 return [KeystoneGlue defaultKeystoneGlue] != nil; |
1000 } | 1003 } |
1001 | 1004 |
1002 string16 CurrentlyInstalledVersion() { | 1005 string16 CurrentlyInstalledVersion() { |
1003 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; | 1006 KeystoneGlue* keystoneGlue = [KeystoneGlue defaultKeystoneGlue]; |
1004 NSString* version = [keystoneGlue currentlyInstalledVersion]; | 1007 NSString* version = [keystoneGlue currentlyInstalledVersion]; |
1005 return base::SysNSStringToUTF16(version); | 1008 return base::SysNSStringToUTF16(version); |
1006 } | 1009 } |
1007 | 1010 |
1008 } // namespace keystone_glue | 1011 } // namespace keystone_glue |
OLD | NEW |