| OLD | NEW |
| 1 // Copyright (c) 2010 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/chromeos/cros/power_library.h" | 5 #include "chrome/browser/chromeos/cros/power_library.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 11 #include "third_party/cros/chromeos_resume.h" | 11 #include "third_party/cros/chromeos_resume.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 DISALLOW_COPY_AND_ASSIGN(PowerLibraryImpl); | 159 DISALLOW_COPY_AND_ASSIGN(PowerLibraryImpl); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class PowerLibraryStubImpl : public PowerLibrary { | 162 class PowerLibraryStubImpl : public PowerLibrary { |
| 163 public: | 163 public: |
| 164 PowerLibraryStubImpl() {} | 164 PowerLibraryStubImpl() {} |
| 165 ~PowerLibraryStubImpl() {} | 165 ~PowerLibraryStubImpl() {} |
| 166 void AddObserver(Observer* observer) {} | 166 void AddObserver(Observer* observer) {} |
| 167 void RemoveObserver(Observer* observer) {} | 167 void RemoveObserver(Observer* observer) {} |
| 168 bool line_power_on() const { return false; } | 168 bool line_power_on() const { return false; } |
| 169 bool battery_is_present() const { return false; } | 169 bool battery_is_present() const { return true; } |
| 170 bool battery_fully_charged() const { return false; } | 170 bool battery_fully_charged() const { return false; } |
| 171 double battery_percentage() const { return false; } | 171 double battery_percentage() const { return 50.0; } |
| 172 base::TimeDelta battery_time_to_empty() const { | 172 base::TimeDelta battery_time_to_empty() const { |
| 173 return base::TimeDelta::FromSeconds(0); | 173 return base::TimeDelta::FromSeconds(10 * 60); |
| 174 } | 174 } |
| 175 base::TimeDelta battery_time_to_full() const { | 175 base::TimeDelta battery_time_to_full() const { |
| 176 return base::TimeDelta::FromSeconds(0); | 176 return base::TimeDelta::FromSeconds(0); |
| 177 } | 177 } |
| 178 virtual void EnableScreenLock(bool enable) {} | 178 virtual void EnableScreenLock(bool enable) {} |
| 179 virtual void RequestRestart() {} | 179 virtual void RequestRestart() {} |
| 180 virtual void RequestShutdown() {} | 180 virtual void RequestShutdown() {} |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // static | 183 // static |
| 184 PowerLibrary* PowerLibrary::GetImpl(bool stub) { | 184 PowerLibrary* PowerLibrary::GetImpl(bool stub) { |
| 185 if (stub) | 185 if (stub) |
| 186 return new PowerLibraryStubImpl(); | 186 return new PowerLibraryStubImpl(); |
| 187 else | 187 else |
| 188 return new PowerLibraryImpl(); | 188 return new PowerLibraryImpl(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace chromeos | 191 } // namespace chromeos |
| 192 | 192 |
| 193 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 193 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 194 // won't be deleted until it's last InvokeLater is run. | 194 // won't be deleted until it's last InvokeLater is run. |
| 195 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); | 195 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::PowerLibraryImpl); |
| OLD | NEW |