Chromium Code Reviews| Index: base/system_monitor/system_monitor.cc |
| diff --git a/base/system_monitor/system_monitor.cc b/base/system_monitor/system_monitor.cc |
| index 28fc70bf2b42a1dd21dc04880ac17efec4ea55ab..62a58801bee5f49c0757386588d4522e0f677a97 100644 |
| --- a/base/system_monitor/system_monitor.cc |
| +++ b/base/system_monitor/system_monitor.cc |
| @@ -1,9 +1,10 @@ |
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/system_monitor/system_monitor.h" |
| +#include "base/file_path.h" |
| #include "base/logging.h" |
| #include "base/message_loop.h" |
| #include "base/time.h" |
| @@ -83,6 +84,16 @@ void SystemMonitor::ProcessDevicesChanged() { |
| NotifyDevicesChanged(); |
| } |
| +void SystemMonitor::ProcessMediaDeviceAttached(const DeviceIdType& id, |
| + const std::string& name, |
| + const FilePath& path) { |
| + NotifyMediaDeviceAttached(id, name, path); |
| +} |
| + |
| +void SystemMonitor::ProcessMediaDeviceDetached(const DeviceIdType& id) { |
| + NotifyMediaDeviceDetached(id); |
| +} |
| + |
| void SystemMonitor::AddPowerObserver(PowerObserver* obs) { |
| power_observer_list_->AddObserver(obs); |
| } |
| @@ -105,6 +116,20 @@ void SystemMonitor::NotifyDevicesChanged() { |
| &DevicesChangedObserver::OnDevicesChanged); |
| } |
| +void SystemMonitor::NotifyMediaDeviceAttached(const DeviceIdType& id, |
| + const std::string& name, |
| + const FilePath& path) { |
| + DVLOG(1) << "MediaDeviceAttached with name " << name << " and id " << id; |
| + devices_changed_observer_list_->Notify( |
| + &DevicesChangedObserver::OnMediaDeviceAttached, id, name, path); |
| +} |
| + |
| +void SystemMonitor::NotifyMediaDeviceDetached(const DeviceIdType& id) { |
| + DVLOG(1) << "MediaDeviceDetached for id " << id; |
| + devices_changed_observer_list_->Notify( |
| + &DevicesChangedObserver::OnMediaDeviceDetached, id); |
| +} |
| + |
| void SystemMonitor::NotifyPowerStateChange() { |
| DVLOG(1) << "PowerStateChange: " << (BatteryPower() ? "On" : "Off") |
| << " battery"; |
| @@ -123,7 +148,9 @@ void SystemMonitor::NotifyResume() { |
| } |
| void SystemMonitor::BatteryCheck() { |
| +#if defined(ENABLE_BATTERY_MONITORING) |
|
Lei Zhang
2012/02/15 23:43:36
I meant putting the #if around the entire method.
|
| ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); |
| +#endif |
| } |
| } // namespace base |