OLD | NEW |
1 // Copyright (c) 2011 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 // TODO(rohitrao): Clean up sites that include mac_util.h and remove this line. | 14 // TODO(rohitrao): Clean up sites that include mac_util.h and remove this line. |
16 #include "base/mac/foundation_util.h" | 15 #include "base/mac/foundation_util.h" |
17 | 16 |
18 #if defined(__OBJC__) | 17 #if defined(__OBJC__) |
19 #import <Foundation/Foundation.h> | 18 #import <Foundation/Foundation.h> |
20 @class NSWindow; | |
21 #else // __OBJC__ | 19 #else // __OBJC__ |
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 namespace base { | 25 namespace base { |
29 namespace mac { | 26 namespace mac { |
30 | 27 |
31 // Full screen modes, in increasing order of priority. More permissive modes | 28 // Full screen modes, in increasing order of priority. More permissive modes |
32 // take predecence. | 29 // take predecence. |
33 enum FullScreenMode { | 30 enum FullScreenMode { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // net effect as a ReleaseFullScreen(from_mode) call followed immediately by a | 67 // net effect as a ReleaseFullScreen(from_mode) call followed immediately by a |
71 // RequestFullScreen(to_mode). Must be called on the main thread. | 68 // RequestFullScreen(to_mode). Must be called on the main thread. |
72 void SwitchFullScreenModes(FullScreenMode from_mode, FullScreenMode to_mode); | 69 void SwitchFullScreenModes(FullScreenMode from_mode, FullScreenMode to_mode); |
73 | 70 |
74 // Set the visibility of the cursor. | 71 // Set the visibility of the cursor. |
75 void SetCursorVisibility(bool visible); | 72 void SetCursorVisibility(bool visible); |
76 | 73 |
77 // Should windows miniaturize on a double-click (on the title bar)? | 74 // Should windows miniaturize on a double-click (on the title bar)? |
78 bool ShouldWindowsMiniaturizeOnDoubleClick(); | 75 bool ShouldWindowsMiniaturizeOnDoubleClick(); |
79 | 76 |
80 // Pulls a snapshot of the entire browser into png_representation. | |
81 void GrabWindowSnapshot(NSWindow* window, | |
82 std::vector<unsigned char>* png_representation, | |
83 int* width, int* height); | |
84 | |
85 // Activates the process with the given PID. | 77 // Activates the process with the given PID. |
86 void ActivateProcess(pid_t pid); | 78 void ActivateProcess(pid_t pid); |
87 | 79 |
88 // Set the Time Machine exclusion property for the given file. | 80 // Set the Time Machine exclusion property for the given file. |
89 bool SetFileBackupExclusion(const FilePath& file_path, bool exclude); | 81 bool SetFileBackupExclusion(const FilePath& file_path, bool exclude); |
90 | 82 |
91 // Sets the process name as displayed in Activity Monitor to process_name. | 83 // Sets the process name as displayed in Activity Monitor to process_name. |
92 void SetProcessName(CFStringRef process_name); | 84 void SetProcessName(CFStringRef process_name); |
93 | 85 |
94 // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do | 86 // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 CF_TO_NS_CAST(CFTimeZoneRef, NSTimeZone); | 157 CF_TO_NS_CAST(CFTimeZoneRef, NSTimeZone); |
166 CF_TO_NS_CAST(CFReadStreamRef, NSInputStream); | 158 CF_TO_NS_CAST(CFReadStreamRef, NSInputStream); |
167 CF_TO_NS_CAST(CFWriteStreamRef, NSOutputStream); | 159 CF_TO_NS_CAST(CFWriteStreamRef, NSOutputStream); |
168 | 160 |
169 #endif // __OBJC__ | 161 #endif // __OBJC__ |
170 | 162 |
171 } // namespace mac | 163 } // namespace mac |
172 } // namespace base | 164 } // namespace base |
173 | 165 |
174 #endif // BASE_MAC_MAC_UTIL_H_ | 166 #endif // BASE_MAC_MAC_UTIL_H_ |
OLD | NEW |