| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "base/mac_util.h" | 5 #include "base/mac_util.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 FSCatalogInfo info; | 37 FSCatalogInfo info; |
| 38 if (FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info, | 38 if (FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info, |
| 39 NULL, NULL, NULL) != noErr) { | 39 NULL, NULL, NULL) != noErr) { |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 return info.nodeFlags & kFSNodeIsDirectoryMask; | 43 return info.nodeFlags & kFSNodeIsDirectoryMask; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool IsBackgroundOnlyProcess() { | 46 bool IsBackgroundOnlyProcess() { |
| 47 NSBundle* main_bundle = MainAppBundle(); | 47 // This function really does want to examine NSBundle's idea of the main |
| 48 NSDictionary* info_dictionary = [main_bundle infoDictionary]; | 48 // bundle dictionary, and not the overriden MainAppBundle. It needs to look |
| 49 // at the actual running .app's Info.plist to access its LSUIElement |
| 50 // property. |
| 51 NSDictionary* info_dictionary = [[NSBundle mainBundle] infoDictionary]; |
| 49 return [[info_dictionary objectForKey:@"LSUIElement"] boolValue] != NO; | 52 return [[info_dictionary objectForKey:@"LSUIElement"] boolValue] != NO; |
| 50 } | 53 } |
| 51 | 54 |
| 52 // No threading worries since NSBundle isn't thread safe. | 55 // No threading worries since NSBundle isn't thread safe. |
| 53 static NSBundle* g_override_app_bundle = nil; | 56 static NSBundle* g_override_app_bundle = nil; |
| 54 | 57 |
| 55 NSBundle* MainAppBundle() { | 58 NSBundle* MainAppBundle() { |
| 56 if (g_override_app_bundle) | 59 if (g_override_app_bundle) |
| 57 return g_override_app_bundle; | 60 return g_override_app_bundle; |
| 58 return [NSBundle mainBundle]; | 61 return [NSBundle mainBundle]; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 NSString* library_dir = [dirs objectAtIndex:0]; | 99 NSString* library_dir = [dirs objectAtIndex:0]; |
| 97 const char* library_dir_path = [library_dir fileSystemRepresentation]; | 100 const char* library_dir_path = [library_dir fileSystemRepresentation]; |
| 98 if (!library_dir_path) | 101 if (!library_dir_path) |
| 99 return FilePath(); | 102 return FilePath(); |
| 100 | 103 |
| 101 return FilePath(library_dir_path); | 104 return FilePath(library_dir_path); |
| 102 } | 105 } |
| 103 | 106 |
| 104 | 107 |
| 105 } // namespace mac_util | 108 } // namespace mac_util |
| OLD | NEW |