| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MAC_UTIL_H_ | 5 #ifndef BASE_MAC_MAC_UTIL_H_ |
| 6 #define BASE_MAC_MAC_UTIL_H_ | 6 #define BASE_MAC_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> | |
| 12 | 11 |
| 13 #include "base/logging.h" | 12 #include "base/logging.h" |
| 14 | 13 |
| 15 #if defined(__OBJC__) | 14 #if defined(__OBJC__) |
| 16 #import <Foundation/Foundation.h> | 15 #import <Foundation/Foundation.h> |
| 17 | 16 |
| 18 @class NSBundle; | 17 @class NSBundle; |
| 19 @class NSWindow; | |
| 20 #else // __OBJC__ | 18 #else // __OBJC__ |
| 21 class NSBundle; | 19 class NSBundle; |
| 22 class NSImage; | 20 class NSImage; |
| 23 class NSWindow; | |
| 24 #endif // __OBJC__ | 21 #endif // __OBJC__ |
| 25 | 22 |
| 26 class FilePath; | 23 class FilePath; |
| 27 | 24 |
| 28 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. | 25 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. |
| 29 #if __LP64__ || NS_BUILD_32_LIKE_64 | 26 #if __LP64__ || NS_BUILD_32_LIKE_64 |
| 30 typedef unsigned long NSSearchPathDirectory; | 27 typedef unsigned long NSSearchPathDirectory; |
| 31 typedef unsigned long NSSearchPathDomainMask; | 28 typedef unsigned long NSSearchPathDomainMask; |
| 32 #else | 29 #else |
| 33 typedef unsigned int NSSearchPathDirectory; | 30 typedef unsigned int NSSearchPathDirectory; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 128 |
| 132 // Set the visibility of the cursor. | 129 // Set the visibility of the cursor. |
| 133 void SetCursorVisibility(bool visible); | 130 void SetCursorVisibility(bool visible); |
| 134 | 131 |
| 135 // Should windows miniaturize on a double-click (on the title bar)? | 132 // Should windows miniaturize on a double-click (on the title bar)? |
| 136 bool ShouldWindowsMiniaturizeOnDoubleClick(); | 133 bool ShouldWindowsMiniaturizeOnDoubleClick(); |
| 137 | 134 |
| 138 // Activates the process with the given PID. | 135 // Activates the process with the given PID. |
| 139 void ActivateProcess(pid_t); | 136 void ActivateProcess(pid_t); |
| 140 | 137 |
| 141 // Pulls a snapshot of the entire browser into png_representation. | |
| 142 void GrabWindowSnapshot(NSWindow* window, | |
| 143 std::vector<unsigned char>* png_representation, | |
| 144 int* width, int* height); | |
| 145 | |
| 146 // Takes a path to an (executable) binary and tries to provide the path to an | 138 // Takes a path to an (executable) binary and tries to provide the path to an |
| 147 // application bundle containing it. It takes the outermost bundle that it can | 139 // application bundle containing it. It takes the outermost bundle that it can |
| 148 // find (so for "/Foo/Bar.app/.../Baz.app/..." it produces "/Foo/Bar.app"). | 140 // find (so for "/Foo/Bar.app/.../Baz.app/..." it produces "/Foo/Bar.app"). |
| 149 // |exec_name| - path to the binary | 141 // |exec_name| - path to the binary |
| 150 // returns - path to the application bundle, or empty on error | 142 // returns - path to the application bundle, or empty on error |
| 151 FilePath GetAppBundlePath(const FilePath& exec_name); | 143 FilePath GetAppBundlePath(const FilePath& exec_name); |
| 152 | 144 |
| 153 // Set the Time Machine exclusion property for the given file. | 145 // Set the Time Machine exclusion property for the given file. |
| 154 bool SetFileBackupExclusion(const FilePath& file_path, bool exclude); | 146 bool SetFileBackupExclusion(const FilePath& file_path, bool exclude); |
| 155 | 147 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 CF_TO_NS_CAST(CFTimeZoneRef, NSTimeZone); | 232 CF_TO_NS_CAST(CFTimeZoneRef, NSTimeZone); |
| 241 CF_TO_NS_CAST(CFReadStreamRef, NSInputStream); | 233 CF_TO_NS_CAST(CFReadStreamRef, NSInputStream); |
| 242 CF_TO_NS_CAST(CFWriteStreamRef, NSOutputStream); | 234 CF_TO_NS_CAST(CFWriteStreamRef, NSOutputStream); |
| 243 | 235 |
| 244 #endif // __OBJC__ | 236 #endif // __OBJC__ |
| 245 | 237 |
| 246 } // namespace mac | 238 } // namespace mac |
| 247 } // namespace base | 239 } // namespace base |
| 248 | 240 |
| 249 #endif // BASE_MAC_MAC_UTIL_H_ | 241 #endif // BASE_MAC_MAC_UTIL_H_ |
| OLD | NEW |