Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / idle.cc
blob7a1994392b8e0d2307d06957f7e3c55c99c539ca
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/idle.h"
7 #include "base/bind.h"
9 namespace {
11 void CalculateIdleStateCallback(int idle_threshold,
12 IdleCallback notify,
13 int idle_time) {
14 if (idle_time >= idle_threshold)
15 notify.Run(IDLE_STATE_IDLE);
16 else
17 notify.Run(IDLE_STATE_ACTIVE);
20 } // namespace
22 void CalculateIdleState(int idle_threshold, IdleCallback notify) {
23 if (CheckIdleStateIsLocked()) {
24 notify.Run(IDLE_STATE_LOCKED);
25 return;
28 CalculateIdleTime(base::Bind(&CalculateIdleStateCallback,
29 idle_threshold,
30 notify));