| Index: base/system_monitor/system_monitor.cc
|
| diff --git a/base/system_monitor/system_monitor.cc b/base/system_monitor/system_monitor.cc
|
| index 2616275dfbc64db88abaa6abb0fa85e8cf561a7d..61889ec3a08c6a56a4ea93775751f17e1341dec7 100644
|
| --- a/base/system_monitor/system_monitor.cc
|
| +++ b/base/system_monitor/system_monitor.cc
|
| @@ -16,12 +16,6 @@ namespace base {
|
|
|
| static SystemMonitor* g_system_monitor = NULL;
|
|
|
| -#if defined(ENABLE_BATTERY_MONITORING)
|
| -// The amount of time (in ms) to wait before running the initial
|
| -// battery check.
|
| -static int kDelayedBatteryCheckMs = 10 * 1000;
|
| -#endif // defined(ENABLE_BATTERY_MONITORING)
|
| -
|
| SystemMonitor::RemovableStorageInfo::RemovableStorageInfo() {
|
| }
|
|
|
| @@ -35,29 +29,13 @@ SystemMonitor::RemovableStorageInfo::RemovableStorageInfo(
|
| }
|
|
|
| SystemMonitor::SystemMonitor()
|
| - : power_observer_list_(new ObserverListThreadSafe<PowerObserver>()),
|
| - devices_changed_observer_list_(
|
| - new ObserverListThreadSafe<DevicesChangedObserver>()),
|
| - battery_in_use_(false),
|
| - suspended_(false) {
|
| + : devices_changed_observer_list_(
|
| + new ObserverListThreadSafe<DevicesChangedObserver>()) {
|
| DCHECK(!g_system_monitor);
|
| g_system_monitor = this;
|
| -
|
| - DCHECK(MessageLoop::current());
|
| -#if defined(ENABLE_BATTERY_MONITORING)
|
| - delayed_battery_check_.Start(FROM_HERE,
|
| - base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this,
|
| - &SystemMonitor::BatteryCheck);
|
| -#endif // defined(ENABLE_BATTERY_MONITORING)
|
| -#if defined(OS_MACOSX)
|
| - PlatformInit();
|
| -#endif
|
| }
|
|
|
| SystemMonitor::~SystemMonitor() {
|
| -#if defined(OS_MACOSX)
|
| - PlatformDestroy();
|
| -#endif
|
| DCHECK_EQ(this, g_system_monitor);
|
| g_system_monitor = NULL;
|
| }
|
| @@ -67,34 +45,6 @@ SystemMonitor* SystemMonitor::Get() {
|
| return g_system_monitor;
|
| }
|
|
|
| -void SystemMonitor::ProcessPowerMessage(PowerEvent event_id) {
|
| - // Suppress duplicate notifications. Some platforms may
|
| - // send multiple notifications of the same event.
|
| - switch (event_id) {
|
| - case POWER_STATE_EVENT:
|
| - {
|
| - bool on_battery = IsBatteryPower();
|
| - if (on_battery != battery_in_use_) {
|
| - battery_in_use_ = on_battery;
|
| - NotifyPowerStateChange();
|
| - }
|
| - }
|
| - break;
|
| - case RESUME_EVENT:
|
| - if (suspended_) {
|
| - suspended_ = false;
|
| - NotifyResume();
|
| - }
|
| - break;
|
| - case SUSPEND_EVENT:
|
| - if (!suspended_) {
|
| - suspended_ = true;
|
| - NotifySuspend();
|
| - }
|
| - break;
|
| - }
|
| -}
|
| -
|
| void SystemMonitor::ProcessDevicesChanged(DeviceType device_type) {
|
| NotifyDevicesChanged(device_type);
|
| }
|
| @@ -140,14 +90,6 @@ SystemMonitor::GetAttachedRemovableStorage() const {
|
| return results;
|
| }
|
|
|
| -void SystemMonitor::AddPowerObserver(PowerObserver* obs) {
|
| - power_observer_list_->AddObserver(obs);
|
| -}
|
| -
|
| -void SystemMonitor::RemovePowerObserver(PowerObserver* obs) {
|
| - power_observer_list_->RemoveObserver(obs);
|
| -}
|
| -
|
| void SystemMonitor::AddDevicesChangedObserver(DevicesChangedObserver* obs) {
|
| devices_changed_observer_list_->AddObserver(obs);
|
| }
|
| @@ -178,25 +120,4 @@ void SystemMonitor::NotifyRemovableStorageDetached(const std::string& id) {
|
| &DevicesChangedObserver::OnRemovableStorageDetached, id);
|
| }
|
|
|
| -void SystemMonitor::NotifyPowerStateChange() {
|
| - DVLOG(1) << "PowerStateChange: " << (BatteryPower() ? "On" : "Off")
|
| - << " battery";
|
| - power_observer_list_->Notify(&PowerObserver::OnPowerStateChange,
|
| - BatteryPower());
|
| -}
|
| -
|
| -void SystemMonitor::NotifySuspend() {
|
| - DVLOG(1) << "Power Suspending";
|
| - power_observer_list_->Notify(&PowerObserver::OnSuspend);
|
| -}
|
| -
|
| -void SystemMonitor::NotifyResume() {
|
| - DVLOG(1) << "Power Resuming";
|
| - power_observer_list_->Notify(&PowerObserver::OnResume);
|
| -}
|
| -
|
| -void SystemMonitor::BatteryCheck() {
|
| - ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT);
|
| -}
|
| -
|
| } // namespace base
|
|
|