Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: chrome/browser/idle_chromeos.cc

Issue 9838085: Move files inside chrome/browser/chromeos/dbus to chromeos/dbus (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/idle.h" 5 #include "chrome/browser/idle.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "chrome/browser/chromeos/dbus/power_manager_client.h" 10 #include "chromeos/dbus/power_manager_client.h"
11 #if !defined(USE_AURA)
12 #include "chrome/browser/screensaver_window_finder_gtk.h"
13 #endif
14 11
15 void CalculateIdleStateNotifier(unsigned int idle_treshold, 12 void CalculateIdleStateNotifier(unsigned int idle_treshold,
16 IdleCallback notify, 13 IdleCallback notify,
17 int64_t idle_time_s) { 14 int64_t idle_time_s) {
18 if (idle_time_s >= (int64_t)idle_treshold) { 15 if (idle_time_s >= (int64_t)idle_treshold) {
19 notify.Run(IDLE_STATE_IDLE); 16 notify.Run(IDLE_STATE_IDLE);
20 } else if (idle_time_s < 0) { 17 } else if (idle_time_s < 0) {
21 notify.Run(IDLE_STATE_UNKNOWN); 18 notify.Run(IDLE_STATE_UNKNOWN);
22 } else { 19 } else {
23 notify.Run(IDLE_STATE_ACTIVE); 20 notify.Run(IDLE_STATE_ACTIVE);
24 } 21 }
25 } 22 }
26 23
27 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { 24 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) {
28 if (CheckIdleStateIsLocked()) {
29 notify.Run(IDLE_STATE_LOCKED);
30 return;
31 }
32 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 25 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
33 CalculateIdleTime(base::Bind(&CalculateIdleStateNotifier, idle_threshold, 26 CalculateIdleTime(base::Bind(&CalculateIdleStateNotifier, idle_threshold,
34 notify)); 27 notify));
35 } 28 }
36 29
37 bool CheckIdleStateIsLocked() { 30 bool CheckIdleStateIsLocked() {
38 // Usually the screensaver is used to lock the screen, so we do not need to 31 // Usually the screensaver is used to lock the screen, so we do not need to
39 // check if the workstation is locked. 32 // check if the workstation is locked.
40 #if defined(USE_AURA) 33 // TODO(oshima): Verify if this behavior is correct.
41 return false; 34 return false;
42 #else
43 return ScreensaverWindowFinder::ScreensaverWindowExists();
44 #endif
45 } 35 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/system/system_apitest.cc ('k') | chrome/browser/policy/device_policy_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698