Index: chrome/browser/automation/testing_automation_provider_chromeos.cc |
diff --git a/chrome/browser/automation/testing_automation_provider_chromeos.cc b/chrome/browser/automation/testing_automation_provider_chromeos.cc |
index 9ca8f98cf4e32d0ee2f4c60d54f8714466ae4388..d721085107e2f912cc63251fd75611031de5c9cf 100644 |
--- a/chrome/browser/automation/testing_automation_provider_chromeos.cc |
+++ b/chrome/browser/automation/testing_automation_provider_chromeos.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/automation/automation_provider_observers.h" |
#include "chrome/browser/chromeos/cros/cros_library.h" |
#include "chrome/browser/chromeos/cros/network_library.h" |
+#include "chrome/browser/chromeos/cros/power_library.h" |
#include "chrome/browser/chromeos/cros/screen_lock_library.h" |
#include "chrome/browser/chromeos/login/existing_user_controller.h" |
#include "chrome/browser/chromeos/login/screen_locker.h" |
@@ -123,6 +124,30 @@ void TestingAutomationProvider::SignoutInScreenLocker( |
screen_locker->Signout(); |
} |
+void TestingAutomationProvider::GetBatteryInfo(DictionaryValue* args, |
+ IPC::Message* reply_message) { |
+ AutomationJSONReply reply(this, reply_message); |
+ |
+ if (!CrosLibrary::Get()->EnsureLoaded()) { |
+ reply.SendError("Could not load cros library."); |
+ return; |
+ } |
+ |
+ chromeos::PowerLibrary* power_library = CrosLibrary::Get()->GetPowerLibrary(); |
+ scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
+ |
+ return_value->SetBoolean("battery", power_library->battery_is_present()); |
Nirnimesh
2011/03/29 01:29:39
Match the key string with the function name as muc
dtu
2011/03/29 02:21:22
Done.
|
+ return_value->SetBoolean("line_power", power_library->line_power_on()); |
+ return_value->SetBoolean("charged", power_library->battery_fully_charged()); |
+ return_value->SetDouble("percentage", power_library->battery_percentage()); |
+ return_value->SetInteger("time_left", |
+ power_library->line_power_on() ? |
+ power_library->battery_time_to_full().InSeconds() : |
+ power_library->battery_time_to_empty().InSeconds()); |
+ |
+ reply.SendSuccess(return_value.get()); |
+} |
+ |
void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, |
IPC::Message* reply_message) { |
AutomationJSONReply reply(this, reply_message); |