blob: 7a1994392b8e0d2307d06957f7e3c55c99c539ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/idle.h"
#include "base/bind.h"
namespace {
void CalculateIdleStateCallback(int idle_threshold,
IdleCallback notify,
int idle_time) {
if (idle_time >= idle_threshold)
notify.Run(IDLE_STATE_IDLE);
else
notify.Run(IDLE_STATE_ACTIVE);
}
} // namespace
void CalculateIdleState(int idle_threshold, IdleCallback notify) {
if (CheckIdleStateIsLocked()) {
notify.Run(IDLE_STATE_LOCKED);
return;
}
CalculateIdleTime(base::Bind(&CalculateIdleStateCallback,
idle_threshold,
notify));
}
|