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

Side by Side Diff: content/renderer/media/media_stream_dispatcher.h

Issue 1928493002: Use url::Origin to represent security origins in MediaStream-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_STREAM_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/media/media_stream_options.h" 18 #include "content/common/media/media_stream_options.h"
19 #include "content/public/renderer/render_frame_observer.h" 19 #include "content/public/renderer/render_frame_observer.h"
20 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" 20 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
21 21
22 namespace url {
23 class Origin;
24 }
25
22 namespace content { 26 namespace content {
23 27
24 // MediaStreamDispatcher is a delegate for the Media Stream API messages. 28 // MediaStreamDispatcher is a delegate for the Media Stream API messages.
25 // MediaStreams are used by WebKit to open media devices such as Video Capture 29 // MediaStreams are used by WebKit to open media devices such as Video Capture
26 // and Audio input devices. 30 // and Audio input devices.
27 // It's the complement of MediaStreamDispatcherHost (owned by 31 // It's the complement of MediaStreamDispatcherHost (owned by
28 // RenderProcessHostImpl). 32 // RenderProcessHostImpl).
29 class CONTENT_EXPORT MediaStreamDispatcher 33 class CONTENT_EXPORT MediaStreamDispatcher
30 : public RenderFrameObserver, 34 : public RenderFrameObserver,
31 public base::SupportsWeakPtr<MediaStreamDispatcher> { 35 public base::SupportsWeakPtr<MediaStreamDispatcher> {
32 public: 36 public:
33 explicit MediaStreamDispatcher(RenderFrame* render_frame); 37 explicit MediaStreamDispatcher(RenderFrame* render_frame);
34 ~MediaStreamDispatcher() override; 38 ~MediaStreamDispatcher() override;
35 39
36 // Request a new media stream to be created. 40 // Request a new media stream to be created.
37 // This can be used either by WebKit or a plugin. 41 // This can be used either by WebKit or a plugin.
38 // Note: The event_handler must be valid for as long as the stream exists. 42 // Note: The event_handler must be valid for as long as the stream exists.
39 virtual void GenerateStream( 43 virtual void GenerateStream(
40 int request_id, 44 int request_id,
41 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 45 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
42 const StreamControls& controls, 46 const StreamControls& controls,
43 const GURL& security_origin); 47 const url::Origin& security_origin);
44 48
45 // Cancel the request for a new media stream to be created. 49 // Cancel the request for a new media stream to be created.
46 virtual void CancelGenerateStream( 50 virtual void CancelGenerateStream(
47 int request_id, 51 int request_id,
48 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); 52 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
49 53
50 // Stop a started device that has been requested by calling GenerateStream. 54 // Stop a started device that has been requested by calling GenerateStream.
51 virtual void StopStreamDevice(const StreamDeviceInfo& device_info); 55 virtual void StopStreamDevice(const StreamDeviceInfo& device_info);
52 56
53 // Request to enumerate devices. 57 // Request to enumerate devices.
54 virtual void EnumerateDevices( 58 virtual void EnumerateDevices(
55 int request_id, 59 int request_id,
56 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 60 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
57 MediaStreamType type, 61 MediaStreamType type,
58 const GURL& security_origin); 62 const url::Origin& security_origin);
59 63
60 // Request to stop enumerating devices. 64 // Request to stop enumerating devices.
61 void StopEnumerateDevices( 65 void StopEnumerateDevices(
62 int request_id, 66 int request_id,
63 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); 67 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
64 68
65 // Request to open a device. 69 // Request to open a device.
66 void OpenDevice( 70 void OpenDevice(
67 int request_id, 71 int request_id,
68 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 72 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
69 const std::string& device_id, 73 const std::string& device_id,
70 MediaStreamType type, 74 MediaStreamType type,
71 const GURL& security_origin); 75 const url::Origin& security_origin);
72 76
73 // Cancel the request to open a device. 77 // Cancel the request to open a device.
74 virtual void CancelOpenDevice( 78 virtual void CancelOpenDevice(
75 int request_id, 79 int request_id,
76 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); 80 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler);
77 81
78 // Close a started device. |label| is provided in OnDeviceOpened. 82 // Close a started device. |label| is provided in OnDeviceOpened.
79 void CloseDevice(const std::string& label); 83 void CloseDevice(const std::string& label);
80 84
81 // Check if the label is a valid stream. 85 // Check if the label is a valid stream.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // been canceled. 140 // been canceled.
137 typedef std::list<Request> RequestList; 141 typedef std::list<Request> RequestList;
138 RequestList requests_; 142 RequestList requests_;
139 143
140 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); 144 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher);
141 }; 145 };
142 146
143 } // namespace content 147 } // namespace content
144 148
145 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ 149 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/public/browser/media_device_id.cc ('k') | content/renderer/media/media_stream_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698