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

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

Issue 7864022: Fixing the bug, that caused UI to hang after unsupported device was inserted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fixes Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/idle.cc ('k') | chrome/browser/idle_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/cros/power_library.h" 10 #include "chrome/browser/chromeos/cros/power_library.h"
11 11
12 void CalculateIdleStateNotifier(unsigned int idle_treshold, 12 void CalculateIdleStateNotifier(unsigned int idle_treshold,
13 IdleCallback notify, 13 IdleCallback notify,
14 int64_t idle_time_s) { 14 int64_t idle_time_s) {
15 if (idle_time_s >= (int64_t)idle_treshold) { 15 if (idle_time_s >= (int64_t)idle_treshold) {
16 notify.Run(IDLE_STATE_IDLE); 16 notify.Run(IDLE_STATE_IDLE);
17 } else if (idle_time_s < 0) { 17 } else if (idle_time_s < 0) {
18 notify.Run(IDLE_STATE_UNKNOWN); 18 notify.Run(IDLE_STATE_UNKNOWN);
19 } else { 19 } else {
20 notify.Run(IDLE_STATE_ACTIVE); 20 notify.Run(IDLE_STATE_ACTIVE);
21 } 21 }
22 } 22 }
23 23
24 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) { 24 void CalculateIdleState(unsigned int idle_threshold, IdleCallback notify) {
25 if (CheckIdleStateIsLocked()) {
26 notify.Run(IDLE_STATE_LOCKED);
27 return;
28 }
25 chromeos::CalculateIdleTimeCallback* callback = 29 chromeos::CalculateIdleTimeCallback* callback =
26 new base::Callback<void(int64_t)>(base::Bind(&CalculateIdleStateNotifier, 30 new base::Callback<void(int64_t)>(base::Bind(&CalculateIdleStateNotifier,
27 idle_threshold, 31 idle_threshold,
28 notify)); 32 notify));
29 chromeos::CrosLibrary::Get()->GetPowerLibrary()->CalculateIdleTime(callback); 33 chromeos::CrosLibrary::Get()->GetPowerLibrary()->CalculateIdleTime(callback);
30 } 34 }
35
36 bool CheckIdleStateIsLocked() {
37 // TODO(sidor): Make it work.
38 return false;
39 }
OLDNEW
« no previous file with comments | « chrome/browser/idle.cc ('k') | chrome/browser/idle_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698