| 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 "chrome/installer/gcapi_mac/gcapi.h" | 5 #include "chrome/installer/gcapi_mac/gcapi.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <grp.h> | 8 #include <grp.h> |
| 9 #include <pwd.h> | 9 #include <pwd.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 int darwin_major_version = atoi(uname_info.release); | 52 int darwin_major_version = atoi(uname_info.release); |
| 53 if (darwin_major_version < 6) | 53 if (darwin_major_version < 6) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 // The Darwin major version is always 4 greater than the Mac OS X minor | 56 // The Darwin major version is always 4 greater than the Mac OS X minor |
| 57 // version for Darwin versions beginning with 6, corresponding to Mac OS X | 57 // version for Darwin versions beginning with 6, corresponding to Mac OS X |
| 58 // 10.2. | 58 // 10.2. |
| 59 int mac_os_x_minor_version = darwin_major_version - 4; | 59 int mac_os_x_minor_version = darwin_major_version - 4; |
| 60 | 60 |
| 61 // Chrome is known to work on 10.9 - 10.11. | 61 // Chrome is known to work on 10.9 - 10.12. |
| 62 return mac_os_x_minor_version >= 9 && mac_os_x_minor_version <= 11; | 62 return mac_os_x_minor_version >= 9 && mac_os_x_minor_version <= 12; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Returns the pid/gid of the logged-in user, even if getuid() claims that the | 65 // Returns the pid/gid of the logged-in user, even if getuid() claims that the |
| 66 // current user is root. | 66 // current user is root. |
| 67 // Returns NULL on error. | 67 // Returns NULL on error. |
| 68 passwd* GetRealUserId() { | 68 passwd* GetRealUserId() { |
| 69 CFDictionaryRef session_info_dict = CGSessionCopyCurrentDictionary(); | 69 CFDictionaryRef session_info_dict = CGSessionCopyCurrentDictionary(); |
| 70 [NSMakeCollectable(session_info_dict) autorelease]; | 70 [NSMakeCollectable(session_info_dict) autorelease]; |
| 71 if (!session_info_dict) | 71 if (!session_info_dict) |
| 72 return NULL; // Possibly no screen plugged in. | 72 return NULL; // Possibly no screen plugged in. |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 else if (FindChromeTicket(kSystemTicket, NULL, &path) && path) | 453 else if (FindChromeTicket(kSystemTicket, NULL, &path) && path) |
| 454 app_path = path; | 454 app_path = path; |
| 455 else | 455 else |
| 456 app_path = kChromeInstallPath; | 456 app_path = kChromeInstallPath; |
| 457 | 457 |
| 458 // NSWorkspace launches processes as the current console owner, | 458 // NSWorkspace launches processes as the current console owner, |
| 459 // even when running with euid of 0. | 459 // even when running with euid of 0. |
| 460 return [[NSWorkspace sharedWorkspace] launchApplication:app_path]; | 460 return [[NSWorkspace sharedWorkspace] launchApplication:app_path]; |
| 461 } | 461 } |
| 462 } | 462 } |
| OLD | NEW |