| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef BASE_MAC_UTIL_H_ | 5 #ifndef BASE_MAC_UTIL_H_ |
| 6 #define BASE_MAC_UTIL_H_ | 6 #define BASE_MAC_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <Carbon/Carbon.h> | 9 #include <Carbon/Carbon.h> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 class FilePath; | 13 class FilePath; |
| 14 | 14 |
| 15 #ifdef __OBJC__ | 15 #ifdef __OBJC__ |
| 16 @class NSBundle; | 16 @class NSBundle; |
| 17 @class NSWindow; | 17 @class NSWindow; |
| 18 #else | 18 #else |
| 19 class NSBundle; | 19 class NSBundle; |
| 20 class NSImage; | 20 class NSImage; |
| 21 class NSWindow; | 21 class NSWindow; |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. | 24 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. |
| 25 #if __LP64__ || NS_BUILD_32_LIKE_64 | 25 #if __LP64__ || NS_BUILD_32_LIKE_64 |
| 26 typedef unsigned long NSSearchPathDirectory; | 26 typedef unsigned long NSSearchPathDirectory; |
| 27 typedef unsigned long NSSearchPathDomainMask; |
| 27 #else | 28 #else |
| 28 typedef unsigned int NSSearchPathDirectory; | 29 typedef unsigned int NSSearchPathDirectory; |
| 30 typedef unsigned int NSSearchPathDomainMask; |
| 29 #endif | 31 #endif |
| 30 | 32 |
| 31 namespace mac_util { | 33 namespace mac_util { |
| 32 | 34 |
| 33 // Full screen modes, in increasing order of priority. More permissive modes | 35 // Full screen modes, in increasing order of priority. More permissive modes |
| 34 // take predecence. | 36 // take predecence. |
| 35 enum FullScreenMode { | 37 enum FullScreenMode { |
| 36 kFullScreenModeHideAll = 0, | 38 kFullScreenModeHideAll = 0, |
| 37 kFullScreenModeHideDock = 1, | 39 kFullScreenModeHideDock = 1, |
| 38 kFullScreenModeAutoHideAll = 2, | 40 kFullScreenModeAutoHideAll = 2, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); | 69 OSType CreatorCodeForCFBundleRef(CFBundleRef bundle); |
| 68 | 70 |
| 69 // Returns the creator code associated with this application, by calling | 71 // Returns the creator code associated with this application, by calling |
| 70 // CreatorCodeForCFBundleRef for the application's main bundle. If this | 72 // CreatorCodeForCFBundleRef for the application's main bundle. If this |
| 71 // information cannot be determined, returns kUnknownType ('????'). This | 73 // information cannot be determined, returns kUnknownType ('????'). This |
| 72 // does not respect the override app bundle because it's based on CFBundle | 74 // does not respect the override app bundle because it's based on CFBundle |
| 73 // instead of NSBundle, and because callers probably don't want the override | 75 // instead of NSBundle, and because callers probably don't want the override |
| 74 // app bundle's creator code anyway. | 76 // app bundle's creator code anyway. |
| 75 OSType CreatorCodeForApplication(); | 77 OSType CreatorCodeForApplication(); |
| 76 | 78 |
| 79 // Searches for directories for the given key in only the given |domain_mask|. |
| 80 // If found, fills result (which must always be non-NULL) with the |
| 81 // first found directory and returns true. Otherwise, returns false. |
| 82 bool GetSearchPathDirectory(NSSearchPathDirectory directory, |
| 83 NSSearchPathDomainMask domain_mask, |
| 84 FilePath* result); |
| 85 |
| 77 // Searches for directories for the given key in only the user domain. | 86 // Searches for directories for the given key in only the user domain. |
| 78 // If found, fills result (which must always be non-NULL) with the | 87 // If found, fills result (which must always be non-NULL) with the |
| 79 // first found directory and returns true. Otherwise, returns false. | 88 // first found directory and returns true. Otherwise, returns false. |
| 80 bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result); | 89 bool GetUserDirectory(NSSearchPathDirectory directory, FilePath* result); |
| 81 | 90 |
| 91 // Searches for directories for the given key in only the local domain. |
| 92 // If found, fills result (which must always be non-NULL) with the |
| 93 // first found directory and returns true. Otherwise, returns false. |
| 94 bool GetLocalDirectory(NSSearchPathDirectory directory, FilePath* result); |
| 95 |
| 82 // Returns the ~/Library directory. | 96 // Returns the ~/Library directory. |
| 83 FilePath GetUserLibraryPath(); | 97 FilePath GetUserLibraryPath(); |
| 84 | 98 |
| 85 // Returns an sRGB color space. The return value is a static value; do not | 99 // Returns an sRGB color space. The return value is a static value; do not |
| 86 // release it! | 100 // release it! |
| 87 CGColorSpaceRef GetSRGBColorSpace(); | 101 CGColorSpaceRef GetSRGBColorSpace(); |
| 88 | 102 |
| 89 // Returns the color space being used by the main display. The return value | 103 // Returns the color space being used by the main display. The return value |
| 90 // is a static value; do not release it! | 104 // is a static value; do not release it! |
| 91 CGColorSpaceRef GetSystemColorSpace(); | 105 CGColorSpaceRef GetSystemColorSpace(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. | 183 // 'Login Item' with 'hide on startup' flag. Used to suppress opening windows. |
| 170 bool WasLaunchedAsHiddenLoginItem(); | 184 bool WasLaunchedAsHiddenLoginItem(); |
| 171 | 185 |
| 172 // Retain/release calls for memory management in C++. | 186 // Retain/release calls for memory management in C++. |
| 173 void NSObjectRetain(void* obj); | 187 void NSObjectRetain(void* obj); |
| 174 void NSObjectRelease(void* obj); | 188 void NSObjectRelease(void* obj); |
| 175 | 189 |
| 176 } // namespace mac_util | 190 } // namespace mac_util |
| 177 | 191 |
| 178 #endif // BASE_MAC_UTIL_H_ | 192 #endif // BASE_MAC_UTIL_H_ |
| OLD | NEW |