Device monitoring in Mac via AVFoundation.

Relanding a couple of CLs with intelligent (humand based) rebase:

- Relanding http://crrev.com/24615005/, first introduction of the
DeviceMonitorMacImpl and associate AVFoundationGlue:
-- AVFoundation glue is cleaned up following posterior comments
to bemasc@ in http://crrev.com/50133002.
-- Including http://crrev.com/43633002, silly typo causing a bug.
-- Merges bemasc@ treatment of suspended devices as not available,
only for QTKit http://crrev.com/55183002. .
-- Adapted the treatment from bemasc@ sorting out the insidious bug,
see below and http://crrev.com/51703003. In this case we add a dummy
entry in the list of devices, and mark it as |kInvalid|.

- Relanding http://crrev.com/40493003, avi@ fix for MEDIA_EXPORT.

- Relanding http://crrev.com/50213004, putting AVFoundation behind flag.
Note that we still are forcing enumeration of devices on startup, but
since it's behind a flag, no penalty is expected in the short term
and in the mid term the whole AVFoundation bringup will be moved to
getUserMedia() runtime.

A very insidious bug was uncovered by bemasc@, when, for performance
reasons we didn't enumerate devices on startup; it could be that a
Mac box would have one camera, not enumerated, and it gets disconnected,
since the init value of the |cached_devices_| is empty, the code would
see no difference and take thus take no action. bemasc@ solved it by
init'ing the device count to -1 both for video and audio.

BUG=288562

Review URL: https://codereview.chromium.org/63103004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233583 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/device_monitor_mac.h b/content/browser/device_monitor_mac.h
index bab522f..6def493 100644
--- a/content/browser/device_monitor_mac.h
+++ b/content/browser/device_monitor_mac.h
@@ -8,19 +8,29 @@
 #include "base/basictypes.h"
 #include "base/system_monitor/system_monitor.h"
 
+namespace {
+class DeviceMonitorMacImpl;
+}
+
 namespace content {
 
+// Class to track audio/video devices removal or addition via callback to
+// base::SystemMonitor ProcessDevicesChanged(). A single object of this class
+// is created from the browser main process and lives as long as this one.
 class DeviceMonitorMac {
  public:
   DeviceMonitorMac();
   ~DeviceMonitorMac();
 
- private:
-  // Forward the notifications to system monitor.
+  // Method called by the internal DeviceMonitorMacImpl object
+  // |device_monitor_impl_| when a device of type |type| has been added to or
+  // removed from the system. This code executes in the notification thread
+  // (QTKit or AVFoundation).
   void NotifyDeviceChanged(base::SystemMonitor::DeviceType type);
 
-  class QTMonitorImpl;
-  scoped_ptr<DeviceMonitorMac::QTMonitorImpl> qt_monitor_;
+ private:
+  scoped_ptr<DeviceMonitorMacImpl> device_monitor_impl_;
+
   DISALLOW_COPY_AND_ASSIGN(DeviceMonitorMac);
 };