Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: base/system_monitor/system_monitor.cc

Issue 10332190: Add SystemMonitor::GetMediaDevices() (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: update comment Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/system_monitor/system_monitor.cc
===================================================================
--- base/system_monitor/system_monitor.cc (revision 137731)
+++ base/system_monitor/system_monitor.cc (working copy)
@@ -4,6 +4,8 @@
#include "base/system_monitor/system_monitor.h"
+#include <utility>
+
#include "base/file_path.h"
#include "base/logging.h"
#include "base/message_loop.h"
@@ -87,13 +89,26 @@
void SystemMonitor::ProcessMediaDeviceAttached(const DeviceIdType& id,
const std::string& name,
const FilePath& path) {
+ media_device_map_.insert(std::make_pair(id, MakeTuple(id, name, path)));
NotifyMediaDeviceAttached(id, name, path);
}
void SystemMonitor::ProcessMediaDeviceDetached(const DeviceIdType& id) {
+ MediaDeviceMap::iterator it = media_device_map_.find(id);
+ if (it != media_device_map_.end())
+ media_device_map_.erase(it);
NotifyMediaDeviceDetached(id);
}
+void SystemMonitor::GetAttachedMediaDevices(
+ std::vector<MediaDeviceInfo>* results) {
+ for (MediaDeviceMap::const_iterator it = media_device_map_.begin();
+ it != media_device_map_.end();
+ ++it) {
+ results->push_back(it->second);
+ }
+}
+
void SystemMonitor::AddPowerObserver(PowerObserver* obs) {
power_observer_list_->AddObserver(obs);
}

Powered by Google App Engine
This is Rietveld 408576698