Disable ContentSettingBubbleModelTest.RPHAllow which is flaky.
[chromium-blink-merge.git] / content / renderer / pepper / pepper_device_enumeration_event_handler.h
blob7ce3436bbf4b90cab6e7e269f8dbe1cf06b52ac7
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_
8 #include <map>
10 #include "base/memory/weak_ptr.h"
11 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
12 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
13 #include "webkit/plugins/ppapi/plugin_delegate.h"
15 namespace content {
17 class PepperDeviceEnumerationEventHandler
18 : public MediaStreamDispatcherEventHandler,
19 public base::SupportsWeakPtr<PepperDeviceEnumerationEventHandler> {
20 public:
21 PepperDeviceEnumerationEventHandler();
22 virtual ~PepperDeviceEnumerationEventHandler();
24 int RegisterEnumerateDevicesCallback(
25 const webkit::ppapi::PluginDelegate::EnumerateDevicesCallback& callback);
26 void UnregisterEnumerateDevicesCallback(int request_id);
28 int RegisterOpenDeviceCallback(
29 const PepperPluginDelegateImpl::OpenDeviceCallback& callback);
31 // MediaStreamDispatcherEventHandler implementation.
32 virtual void OnStreamGenerated(
33 int request_id,
34 const std::string& label,
35 const StreamDeviceInfoArray& audio_device_array,
36 const StreamDeviceInfoArray& video_device_array) OVERRIDE;
37 virtual void OnStreamGenerationFailed(int request_id) OVERRIDE;
38 virtual void OnDevicesEnumerated(
39 int request_id,
40 const StreamDeviceInfoArray& device_array) OVERRIDE;
41 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE;
42 virtual void OnDeviceOpened(
43 int request_id,
44 const std::string& label,
45 const StreamDeviceInfo& device_info) OVERRIDE;
46 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE;
48 // Stream type conversion.
49 static MediaStreamType FromPepperDeviceType(PP_DeviceType_Dev type);
50 static PP_DeviceType_Dev FromMediaStreamType(MediaStreamType type);
52 private:
53 void NotifyDevicesEnumerated(
54 int request_id,
55 bool succeeded,
56 const StreamDeviceInfoArray& device_array);
58 void NotifyDeviceOpened(int request_id,
59 bool succeeded,
60 const std::string& label);
62 int next_id_;
64 typedef std::map<int,
65 webkit::ppapi::PluginDelegate::EnumerateDevicesCallback>
66 EnumerateCallbackMap;
67 EnumerateCallbackMap enumerate_callbacks_;
69 typedef std::map<int, PepperPluginDelegateImpl::OpenDeviceCallback>
70 OpenCallbackMap;
71 OpenCallbackMap open_callbacks_;
73 DISALLOW_COPY_AND_ASSIGN(PepperDeviceEnumerationEventHandler);
76 } // namespace content
78 #endif // CONTENT_RENDERER_PEPPER_PEPPER_DEVICE_ENUMERATION_EVENT_HANDLER_H_