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