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. 4 5 #include "ui/base/idle/idle.h" 6 7 #include "ui/base/idle/idle_internal.h" 8 9 namespace ui { 10 CalculateIdleState(int idle_threshold)11IdleState CalculateIdleState(int idle_threshold) { 12 if (IdleStateForTesting().has_value()) 13 return IdleStateForTesting().value(); 14 15 if (CheckIdleStateIsLocked()) 16 return IDLE_STATE_LOCKED; 17 18 if (CalculateIdleTime() >= idle_threshold) 19 return IDLE_STATE_IDLE; 20 21 return IDLE_STATE_ACTIVE; 22 } 23 24 } // namespace ui 25