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 "base/mac/mac_util.h" | 5 #include "base/mac/mac_util.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #import <IOKit/IOKitLib.h> | 8 #import <IOKit/IOKitLib.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 DCHECK_GT(g_full_screen_requests[from_mode], 0); | 212 DCHECK_GT(g_full_screen_requests[from_mode], 0); |
213 DCHECK_GE(g_full_screen_requests[to_mode], 0); | 213 DCHECK_GE(g_full_screen_requests[to_mode], 0); |
214 g_full_screen_requests[from_mode] = | 214 g_full_screen_requests[from_mode] = |
215 std::max(g_full_screen_requests[from_mode] - 1, 0); | 215 std::max(g_full_screen_requests[from_mode] - 1, 0); |
216 g_full_screen_requests[to_mode] = | 216 g_full_screen_requests[to_mode] = |
217 std::max(g_full_screen_requests[to_mode] + 1, 1); | 217 std::max(g_full_screen_requests[to_mode] + 1, 1); |
218 SetUIMode(); | 218 SetUIMode(); |
219 } | 219 } |
220 | 220 |
221 void SetCursorVisibility(bool visible) { | |
222 if (visible) | |
223 [NSCursor unhide]; | |
224 else | |
225 [NSCursor hide]; | |
226 } | |
227 | |
228 void ActivateProcess(pid_t pid) { | |
229 ProcessSerialNumber process; | |
230 OSStatus status = GetProcessForPID(pid, &process); | |
231 if (status == noErr) { | |
232 SetFrontProcess(&process); | |
233 } else { | |
234 OSSTATUS_DLOG(WARNING, status) << "Unable to get process for pid " << pid; | |
235 } | |
236 } | |
237 | |
238 bool AmIForeground() { | 221 bool AmIForeground() { |
239 ProcessSerialNumber foreground_psn = { 0 }; | 222 ProcessSerialNumber foreground_psn = { 0 }; |
240 OSErr err = GetFrontProcess(&foreground_psn); | 223 OSErr err = GetFrontProcess(&foreground_psn); |
241 if (err != noErr) { | 224 if (err != noErr) { |
242 OSSTATUS_DLOG(WARNING, err) << "GetFrontProcess"; | 225 OSSTATUS_DLOG(WARNING, err) << "GetFrontProcess"; |
243 return false; | 226 return false; |
244 } | 227 } |
245 | 228 |
246 ProcessSerialNumber my_psn = { 0, kCurrentProcess }; | 229 ProcessSerialNumber my_psn = { 0, kCurrentProcess }; |
247 | 230 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 570 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
588 return false; | 571 return false; |
589 *type = ident.substr(0, number_loc); | 572 *type = ident.substr(0, number_loc); |
590 *major = major_tmp; | 573 *major = major_tmp; |
591 *minor = minor_tmp; | 574 *minor = minor_tmp; |
592 return true; | 575 return true; |
593 } | 576 } |
594 | 577 |
595 } // namespace mac | 578 } // namespace mac |
596 } // namespace base | 579 } // namespace base |
OLD | NEW |