Home | History | Annotate | Download | only in browser
      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.
      4 
      5 #include "chrome/browser/idle.h"
      6 
      7 #include "base/basictypes.h"
      8 
      9 #if defined(USE_X11)
     10 #include "chrome/browser/idle_query_x11.h"
     11 #endif
     12 
     13 #if !defined(OS_CHROMEOS)
     14 #include "chrome/browser/screensaver_window_finder_x11.h"
     15 #endif
     16 
     17 void CalculateIdleTime(IdleTimeCallback notify) {
     18 #if defined(USE_X11)
     19   chrome::IdleQueryX11 idle_query;
     20   notify.Run(idle_query.IdleTime());
     21 #endif
     22 }
     23 
     24 bool CheckIdleStateIsLocked() {
     25   // Usually the screensaver is used to lock the screen, so we do not need to
     26   // check if the workstation is locked.
     27 #if defined(OS_CHROMEOS)
     28   return false;
     29 #else
     30   return ScreensaverWindowFinder::ScreensaverWindowExists();
     31 #endif
     32 }
     33