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

Side by Side Diff: content/renderer/pepper/pepper_media_device_manager.h

Issue 364123002: [Cross-Site Isolation] Migrate entire MediaStream verticals to be per-RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It's random enough. + REBASE Created 6 years, 5 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 | Annotate | Revision Log
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_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "content/public/renderer/render_frame_observer.h"
12 #include "content/public/renderer/render_frame_observer_tracker.h"
11 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h" 13 #include "content/renderer/media/media_stream_dispatcher_eventhandler.h"
12 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h" 14 #include "content/renderer/pepper/pepper_device_enumeration_host_helper.h"
13 #include "content/public/renderer/render_view_observer_tracker.h"
14 #include "content/public/renderer/render_view_observer.h"
15 15
16 namespace content { 16 namespace content {
17 class RenderViewImpl; 17 class MediaStreamDispatcher;
18 18
19 class PepperMediaDeviceManager 19 class PepperMediaDeviceManager
20 : public MediaStreamDispatcherEventHandler, 20 : public MediaStreamDispatcherEventHandler,
21 public PepperDeviceEnumerationHostHelper::Delegate, 21 public PepperDeviceEnumerationHostHelper::Delegate,
22 public RenderViewObserver, 22 public RenderFrameObserver,
23 public RenderViewObserverTracker<PepperMediaDeviceManager>, 23 public RenderFrameObserverTracker<PepperMediaDeviceManager>,
24 public base::SupportsWeakPtr<PepperMediaDeviceManager> { 24 public base::SupportsWeakPtr<PepperMediaDeviceManager> {
25 public: 25 public:
26 static PepperMediaDeviceManager* GetForRenderView(RenderView* render_view); 26 static PepperMediaDeviceManager* GetForRenderFrame(RenderFrame* render_frame);
27 virtual ~PepperMediaDeviceManager(); 27 virtual ~PepperMediaDeviceManager();
28 28
29 // PepperDeviceEnumerationHostHelper::Delegate implementation: 29 // PepperDeviceEnumerationHostHelper::Delegate implementation:
30 virtual int EnumerateDevices(PP_DeviceType_Dev type, 30 virtual int EnumerateDevices(PP_DeviceType_Dev type,
31 const GURL& document_url, 31 const GURL& document_url,
32 const EnumerateDevicesCallback& callback) 32 const EnumerateDevicesCallback& callback)
33 OVERRIDE; 33 OVERRIDE;
34 virtual void StopEnumerateDevices(int request_id) OVERRIDE; 34 virtual void StopEnumerateDevices(int request_id) OVERRIDE;
35 35
36 typedef base::Callback<void(int /* request_id */, 36 typedef base::Callback<void(int /* request_id */,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual void OnDeviceOpened(int request_id, 71 virtual void OnDeviceOpened(int request_id,
72 const std::string& label, 72 const std::string& label,
73 const StreamDeviceInfo& device_info) OVERRIDE; 73 const StreamDeviceInfo& device_info) OVERRIDE;
74 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; 74 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE;
75 75
76 // Stream type conversion. 76 // Stream type conversion.
77 static MediaStreamType FromPepperDeviceType(PP_DeviceType_Dev type); 77 static MediaStreamType FromPepperDeviceType(PP_DeviceType_Dev type);
78 static PP_DeviceType_Dev FromMediaStreamType(MediaStreamType type); 78 static PP_DeviceType_Dev FromMediaStreamType(MediaStreamType type);
79 79
80 private: 80 private:
81 PepperMediaDeviceManager(RenderView* render_view); 81 explicit PepperMediaDeviceManager(RenderFrame* render_frame);
82
83 // Called by StopEnumerateDevices() after returing to the event loop, to avoid
84 // a reentrancy problem.
85 void StopEnumerateDevicesDelayed(int request_id);
82 86
83 void NotifyDeviceOpened(int request_id, 87 void NotifyDeviceOpened(int request_id,
84 bool succeeded, 88 bool succeeded,
85 const std::string& label); 89 const std::string& label);
86 90
87 RenderViewImpl* GetRenderViewImpl(); 91
92 MediaStreamDispatcher* GetMediaStreamDispatcher() const;
88 93
89 int next_id_; 94 int next_id_;
90 95
91 typedef std::map<int, EnumerateDevicesCallback> EnumerateCallbackMap; 96 typedef std::map<int, EnumerateDevicesCallback> EnumerateCallbackMap;
92 EnumerateCallbackMap enumerate_callbacks_; 97 EnumerateCallbackMap enumerate_callbacks_;
93 98
94 typedef std::map<int, OpenDeviceCallback> OpenCallbackMap; 99 typedef std::map<int, OpenDeviceCallback> OpenCallbackMap;
95 OpenCallbackMap open_callbacks_; 100 OpenCallbackMap open_callbacks_;
96 101
97 DISALLOW_COPY_AND_ASSIGN(PepperMediaDeviceManager); 102 DISALLOW_COPY_AND_ASSIGN(PepperMediaDeviceManager);
98 }; 103 };
99 104
100 } // namespace content 105 } // namespace content
101 106
102 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_ 107 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_audio_input_host.cc ('k') | content/renderer/pepper/pepper_media_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698