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

Unified Diff: base/system_monitor/system_monitor.cc

Issue 10332190: Add SystemMonitor::GetMediaDevices() (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « base/system_monitor/system_monitor.h ('k') | base/system_monitor/system_monitor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/system_monitor/system_monitor.cc
===================================================================
--- base/system_monitor/system_monitor.cc (revision 138120)
+++ 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,28 @@
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);
}
+std::vector<SystemMonitor::MediaDeviceInfo>*
+SystemMonitor::GetAttachedMediaDevices() const {
+ std::vector<MediaDeviceInfo>* results = new std::vector<MediaDeviceInfo>;
+ for (MediaDeviceMap::const_iterator it = media_device_map_.begin();
+ it != media_device_map_.end();
+ ++it) {
+ results->push_back(it->second);
+ }
+ return results;
+}
+
void SystemMonitor::AddPowerObserver(PowerObserver* obs) {
power_observer_list_->AddObserver(obs);
}
« no previous file with comments | « base/system_monitor/system_monitor.h ('k') | base/system_monitor/system_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698