| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/media/media_devices.h" | 11 #include "content/common/media/media_devices.h" |
| 12 #include "content/common/media/media_devices.mojom.h" | 12 #include "content/common/media/media_devices.mojom.h" |
| 13 | 13 |
| 14 namespace service_manager { |
| 15 struct BindSourceInfo; |
| 16 } |
| 17 |
| 14 namespace content { | 18 namespace content { |
| 15 | 19 |
| 16 // This class implements a Mojo object that receives notifications about changes | 20 // This class implements a Mojo object that receives notifications about changes |
| 17 // in the set of media devices for a given frame. | 21 // in the set of media devices for a given frame. |
| 18 class CONTENT_EXPORT MediaDevicesListenerImpl | 22 class CONTENT_EXPORT MediaDevicesListenerImpl |
| 19 : public ::mojom::MediaDevicesListener { | 23 : public ::mojom::MediaDevicesListener { |
| 20 public: | 24 public: |
| 21 static void Create(int render_frame_id, | 25 static void Create(int render_frame_id, |
| 26 const service_manager::BindSourceInfo& source_info, |
| 22 ::mojom::MediaDevicesListenerRequest request); | 27 ::mojom::MediaDevicesListenerRequest request); |
| 23 explicit MediaDevicesListenerImpl(int render_frame_id); | 28 explicit MediaDevicesListenerImpl(int render_frame_id); |
| 24 ~MediaDevicesListenerImpl() override; | 29 ~MediaDevicesListenerImpl() override; |
| 25 | 30 |
| 26 // ::mojom::MediaDevicesListener implementation. | 31 // ::mojom::MediaDevicesListener implementation. |
| 27 void OnDevicesChanged(MediaDeviceType type, | 32 void OnDevicesChanged(MediaDeviceType type, |
| 28 uint32_t subscription_id, | 33 uint32_t subscription_id, |
| 29 const MediaDeviceInfoArray& device_infos) override; | 34 const MediaDeviceInfoArray& device_infos) override; |
| 30 | 35 |
| 31 private: | 36 private: |
| 32 // Used for DCHECKs so methods calls won't execute in the wrong thread. | 37 // Used for DCHECKs so methods calls won't execute in the wrong thread. |
| 33 base::ThreadChecker thread_checker_; | 38 base::ThreadChecker thread_checker_; |
| 34 | 39 |
| 35 int render_frame_id_; | 40 int render_frame_id_; |
| 36 | 41 |
| 37 DISALLOW_COPY_AND_ASSIGN(MediaDevicesListenerImpl); | 42 DISALLOW_COPY_AND_ASSIGN(MediaDevicesListenerImpl); |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 } // namespace content | 45 } // namespace content |
| 41 | 46 |
| 42 #endif // CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ | 47 #endif // CONTENT_RENDERER_MEDIA_MEDIA_DEVICES_LISTENER_IMPL_H_ |
| OLD | NEW |