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 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 SetUIMode(); | 218 SetUIMode(); |
219 } | 219 } |
220 | 220 |
221 void SetCursorVisibility(bool visible) { | 221 void SetCursorVisibility(bool visible) { |
222 if (visible) | 222 if (visible) |
223 [NSCursor unhide]; | 223 [NSCursor unhide]; |
224 else | 224 else |
225 [NSCursor hide]; | 225 [NSCursor hide]; |
226 } | 226 } |
227 | 227 |
228 bool ShouldWindowsMiniaturizeOnDoubleClick() { | |
229 // We use an undocumented method in Cocoa; if it doesn't exist, default to | |
230 // |true|. If it ever goes away, we can do (using an undocumented pref key): | |
231 // NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | |
232 // return ![defaults objectForKey:@"AppleMiniaturizeOnDoubleClick"] || | |
233 // [defaults boolForKey:@"AppleMiniaturizeOnDoubleClick"]; | |
234 BOOL methodImplemented = | |
235 [NSWindow respondsToSelector:@selector(_shouldMiniaturizeOnDoubleClick)]; | |
236 DCHECK(methodImplemented); | |
237 return !methodImplemented || | |
238 [NSWindow performSelector:@selector(_shouldMiniaturizeOnDoubleClick)]; | |
239 } | |
240 | |
241 void ActivateProcess(pid_t pid) { | 228 void ActivateProcess(pid_t pid) { |
242 ProcessSerialNumber process; | 229 ProcessSerialNumber process; |
243 OSStatus status = GetProcessForPID(pid, &process); | 230 OSStatus status = GetProcessForPID(pid, &process); |
244 if (status == noErr) { | 231 if (status == noErr) { |
245 SetFrontProcess(&process); | 232 SetFrontProcess(&process); |
246 } else { | 233 } else { |
247 OSSTATUS_DLOG(WARNING, status) << "Unable to get process for pid " << pid; | 234 OSSTATUS_DLOG(WARNING, status) << "Unable to get process for pid " << pid; |
248 } | 235 } |
249 } | 236 } |
250 | 237 |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) | 585 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) |
599 return false; | 586 return false; |
600 *type = ident.substr(0, number_loc); | 587 *type = ident.substr(0, number_loc); |
601 *major = major_tmp; | 588 *major = major_tmp; |
602 *minor = minor_tmp; | 589 *minor = minor_tmp; |
603 return true; | 590 return true; |
604 } | 591 } |
605 | 592 |
606 } // namespace mac | 593 } // namespace mac |
607 } // namespace base | 594 } // namespace base |
OLD | NEW |