Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / media / media_stream_dispatcher_host.h
blobf35ae26e992f44139c594cb0053e0aab90e6b8e4
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_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_
8 #include <map>
9 #include <string>
10 #include <utility>
12 #include "content/browser/renderer_host/media/media_stream_manager.h"
13 #include "content/browser/renderer_host/media/media_stream_requester.h"
14 #include "content/common/content_export.h"
15 #include "content/common/media/media_stream_options.h"
16 #include "content/public/browser/browser_message_filter.h"
17 #include "content/public/browser/resource_context.h"
19 namespace content {
21 class MediaStreamManager;
22 class ResourceContext;
24 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by
25 // MediaStreamImpl. There is one MediaStreamDispatcherHost per
26 // RenderProcessHost, the former owned by the latter.
27 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter,
28 public MediaStreamRequester {
29 public:
30 MediaStreamDispatcherHost(
31 int render_process_id,
32 const ResourceContext::SaltCallback& salt_callback,
33 MediaStreamManager* media_stream_manager);
35 // MediaStreamRequester implementation.
36 void StreamGenerated(int render_frame_id,
37 int page_request_id,
38 const std::string& label,
39 const StreamDeviceInfoArray& audio_devices,
40 const StreamDeviceInfoArray& video_devices) override;
41 void StreamGenerationFailed(
42 int render_frame_id,
43 int page_request_id,
44 content::MediaStreamRequestResult result) override;
45 void DeviceStopped(int render_frame_id,
46 const std::string& label,
47 const StreamDeviceInfo& device) override;
48 void DevicesEnumerated(int render_frame_id,
49 int page_request_id,
50 const std::string& label,
51 const StreamDeviceInfoArray& devices) override;
52 void DeviceOpened(int render_frame_id,
53 int page_request_id,
54 const std::string& label,
55 const StreamDeviceInfo& video_device) override;
57 // BrowserMessageFilter implementation.
58 bool OnMessageReceived(const IPC::Message& message) override;
59 void OnChannelClosing() override;
61 protected:
62 ~MediaStreamDispatcherHost() override;
64 private:
65 friend class MockMediaStreamDispatcherHost;
67 void OnGenerateStream(int render_frame_id,
68 int page_request_id,
69 const StreamOptions& components,
70 const GURL& security_origin,
71 bool user_gesture);
72 void OnCancelGenerateStream(int render_frame_id,
73 int page_request_id);
74 void OnStopStreamDevice(int render_frame_id,
75 const std::string& device_id);
77 void OnEnumerateDevices(int render_frame_id,
78 int page_request_id,
79 MediaStreamType type,
80 const GURL& security_origin);
82 void OnCancelEnumerateDevices(int render_frame_id,
83 int page_request_id);
85 void OnOpenDevice(int render_frame_id,
86 int page_request_id,
87 const std::string& device_id,
88 MediaStreamType type,
89 const GURL& security_origin);
91 void OnCloseDevice(int render_frame_id,
92 const std::string& label);
94 void StoreRequest(int render_frame_id,
95 int page_request_id,
96 const std::string& label);
98 bool IsURLAllowed(const GURL& url);
100 int render_process_id_;
101 ResourceContext::SaltCallback salt_callback_;
102 MediaStreamManager* media_stream_manager_;
104 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost);
107 } // namespace content
109 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_