OLD | NEW |
1 // Copyright (c) 2011 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 #import "chrome/browser/idle.h" | 5 #include "chrome/browser/idle.h" |
6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> |
7 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
8 #import <CoreGraphics/CGEventSource.h> | |
9 | 9 |
10 @interface MacScreenMonitor : NSObject { | 10 @interface MacScreenMonitor : NSObject { |
11 @private | 11 @private |
12 BOOL screensaverRunning_; | 12 BOOL screensaverRunning_; |
13 BOOL screenLocked_; | 13 BOOL screenLocked_; |
14 } | 14 } |
15 | 15 |
16 @property (readonly, | 16 @property (readonly, |
17 nonatomic, | 17 nonatomic, |
18 getter=isScreensaverRunning) BOOL screensaverRunning; | 18 getter=isScreensaverRunning) BOOL screensaverRunning; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (idle_time >= idle_threshold) | 96 if (idle_time >= idle_threshold) |
97 notify.Run(IDLE_STATE_IDLE); | 97 notify.Run(IDLE_STATE_IDLE); |
98 else | 98 else |
99 notify.Run(IDLE_STATE_ACTIVE); | 99 notify.Run(IDLE_STATE_ACTIVE); |
100 } | 100 } |
101 | 101 |
102 bool CheckIdleStateIsLocked() { | 102 bool CheckIdleStateIsLocked() { |
103 return [g_screenMonitor isScreensaverRunning] || | 103 return [g_screenMonitor isScreensaverRunning] || |
104 [g_screenMonitor isScreenLocked]; | 104 [g_screenMonitor isScreenLocked]; |
105 } | 105 } |
OLD | NEW |