OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/sync/engine/syncer_thread.h" | 5 #include "chrome/browser/sync/engine/syncer_thread.h" |
6 | 6 |
| 7 #include "build/build_config.h" |
| 8 |
7 #ifdef OS_MACOSX | 9 #ifdef OS_MACOSX |
8 #include <CoreFoundation/CFNumber.h> | 10 #include <CoreFoundation/CFNumber.h> |
9 #include <IOKit/IOTypes.h> | 11 #include <IOKit/IOTypes.h> |
10 #include <IOKit/IOKitLib.h> | 12 #include <IOKit/IOKitLib.h> |
11 #endif | 13 #endif |
12 | 14 |
13 #include <algorithm> | 15 #include <algorithm> |
14 #include <map> | 16 #include <map> |
15 #include <queue> | 17 #include <queue> |
16 | 18 |
(...skipping 10 matching lines...) Expand all Loading... |
27 | 29 |
28 static inline bool operator < (const timespec& a, const timespec& b) { | 30 static inline bool operator < (const timespec& a, const timespec& b) { |
29 return a.tv_sec == b.tv_sec ? a.tv_nsec < b.tv_nsec : a.tv_sec < b.tv_sec; | 31 return a.tv_sec == b.tv_sec ? a.tv_nsec < b.tv_nsec : a.tv_sec < b.tv_sec; |
30 } | 32 } |
31 | 33 |
32 namespace { | 34 namespace { |
33 | 35 |
34 // Returns the amount of time since the user last interacted with the computer, | 36 // Returns the amount of time since the user last interacted with the computer, |
35 // in milliseconds | 37 // in milliseconds |
36 int UserIdleTime() { | 38 int UserIdleTime() { |
37 #ifdef OS_WINDOWS | 39 #ifdef OS_WIN |
38 LASTINPUTINFO last_input_info; | 40 LASTINPUTINFO last_input_info; |
39 last_input_info.cbSize = sizeof(LASTINPUTINFO); | 41 last_input_info.cbSize = sizeof(LASTINPUTINFO); |
40 | 42 |
41 // Get time in windows ticks since system start of last activity. | 43 // Get time in windows ticks since system start of last activity. |
42 BOOL b = ::GetLastInputInfo(&last_input_info); | 44 BOOL b = ::GetLastInputInfo(&last_input_info); |
43 if (b == TRUE) | 45 if (b == TRUE) |
44 return ::GetTickCount() - last_input_info.dwTime; | 46 return ::GetTickCount() - last_input_info.dwTime; |
45 #elif defined(OS_MACOSX) | 47 #elif defined(OS_MACOSX) |
46 // It would be great to do something like: | 48 // It would be great to do something like: |
47 // | 49 // |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 default: | 550 default: |
549 break; | 551 break; |
550 } | 552 } |
551 | 553 |
552 if (NULL != syncer_) { | 554 if (NULL != syncer_) { |
553 syncer_->set_notifications_enabled(p2p_authenticated_ && p2p_subscribed_); | 555 syncer_->set_notifications_enabled(p2p_authenticated_ && p2p_subscribed_); |
554 } | 556 } |
555 } | 557 } |
556 | 558 |
557 } // namespace browser_sync | 559 } // namespace browser_sync |
OLD | NEW |