| OLD | NEW |
| 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 339 |
| 340 void TestingAutomationProvider::GetBatteryInfo(DictionaryValue* args, | 340 void TestingAutomationProvider::GetBatteryInfo(DictionaryValue* args, |
| 341 IPC::Message* reply_message) { | 341 IPC::Message* reply_message) { |
| 342 if (!EnsureCrosLibraryLoaded(this, reply_message)) | 342 if (!EnsureCrosLibraryLoaded(this, reply_message)) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 chromeos::PowerLibrary* power_library = CrosLibrary::Get()->GetPowerLibrary(); | 345 chromeos::PowerLibrary* power_library = CrosLibrary::Get()->GetPowerLibrary(); |
| 346 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 346 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
| 347 | 347 |
| 348 return_value->SetBoolean("battery_is_present", | 348 return_value->SetBoolean("battery_is_present", |
| 349 power_library->battery_is_present()); | 349 power_library->IsBatteryPresent()); |
| 350 return_value->SetBoolean("line_power_on", power_library->line_power_on()); | 350 return_value->SetBoolean("line_power_on", power_library->IsLinePowerOn()); |
| 351 if (power_library->battery_is_present()) { | 351 if (power_library->IsBatteryPresent()) { |
| 352 return_value->SetBoolean("battery_fully_charged", | 352 return_value->SetBoolean("battery_fully_charged", |
| 353 power_library->battery_fully_charged()); | 353 power_library->IsBatteryFullyCharged()); |
| 354 return_value->SetDouble("battery_percentage", | 354 return_value->SetDouble("battery_percentage", |
| 355 power_library->battery_percentage()); | 355 power_library->GetBatteryPercentage()); |
| 356 if (power_library->line_power_on()) { | 356 if (power_library->IsLinePowerOn()) { |
| 357 int time = power_library->battery_time_to_full().InSeconds(); | 357 int time = power_library->GetBatteryTimeToFull().InSeconds(); |
| 358 if (time > 0 || power_library->battery_fully_charged()) | 358 if (time > 0 || power_library->IsBatteryFullyCharged()) |
| 359 return_value->SetInteger("battery_time_to_full", time); | 359 return_value->SetInteger("battery_time_to_full", time); |
| 360 } else { | 360 } else { |
| 361 int time = power_library->battery_time_to_empty().InSeconds(); | 361 int time = power_library->GetBatteryTimeToEmpty().InSeconds(); |
| 362 if (time > 0) | 362 if (time > 0) |
| 363 return_value->SetInteger("battery_time_to_empty", time); | 363 return_value->SetInteger("battery_time_to_empty", time); |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 367 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, | 370 void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, |
| 371 IPC::Message* reply_message) { | 371 IPC::Message* reply_message) { |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1194 | 1194 |
| 1195 // Set up an observer (it will delete itself). | 1195 // Set up an observer (it will delete itself). |
| 1196 take_photo_dialog->AddObserver(new PhotoCaptureObserver( | 1196 take_photo_dialog->AddObserver(new PhotoCaptureObserver( |
| 1197 this, reply_message)); | 1197 this, reply_message)); |
| 1198 | 1198 |
| 1199 views::Widget* window = browser::CreateViewsWindow( | 1199 views::Widget* window = browser::CreateViewsWindow( |
| 1200 browser->window()->GetNativeHandle(), take_photo_dialog); | 1200 browser->window()->GetNativeHandle(), take_photo_dialog); |
| 1201 window->SetAlwaysOnTop(true); | 1201 window->SetAlwaysOnTop(true); |
| 1202 window->Show(); | 1202 window->Show(); |
| 1203 } | 1203 } |
| OLD | NEW |