Delay app cache check until flag file indicates that it is ready
[chromium-blink-merge.git] / chrome / browser / idle.h
blobd558960ef775476abadffa2ea93c9f43b1b1990f
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_IDLE_H_
6 #define CHROME_BROWSER_IDLE_H_
8 #include "base/callback.h"
10 enum IdleState {
11 IDLE_STATE_ACTIVE = 0,
12 IDLE_STATE_IDLE = 1, // No activity within threshold.
13 IDLE_STATE_LOCKED = 2, // Only available on supported systems.
14 IDLE_STATE_UNKNOWN = 3 // Used when waiting for the Idle state or in error
15 // conditions
18 // For MacOSX, InitIdleMonitor needs to be called first to setup the monitor.
19 #if defined(OS_MACOSX)
20 void InitIdleMonitor();
21 #endif
23 typedef base::Callback<void(IdleState)> IdleCallback;
24 typedef base::Callback<void(int)> IdleTimeCallback;
26 // Calculate the Idle state and notify the callback. |idle_threshold| is the
27 // amount of time (in seconds) before considered idle. |notify| is
28 // asynchronously called on some platforms.
29 void CalculateIdleState(int idle_threshold, IdleCallback notify);
31 // Calculate Idle time in seconds and notify the callback
32 void CalculateIdleTime(IdleTimeCallback notify);
34 // Checks synchronously if Idle state is IDLE_STATE_LOCKED.
35 bool CheckIdleStateIsLocked();
37 #endif // CHROME_BROWSER_IDLE_H_