OLD | NEW |
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 #include "content/browser/renderer_host/media/media_stream_device_settings.h" | 5 #include "content/browser/renderer_host/media/media_stream_device_settings.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 std::string device_id_; | 72 std::string device_id_; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 | 76 |
77 namespace media_stream { | 77 namespace media_stream { |
78 | 78 |
79 typedef std::map< MediaStreamType, StreamDeviceInfoArray > DeviceMap; | 79 typedef std::map<MediaStreamType, StreamDeviceInfoArray> DeviceMap; |
80 | 80 |
81 // Device request contains all data needed to keep track of requests between the | 81 // Device request contains all data needed to keep track of requests between the |
82 // different calls. | 82 // different calls. |
83 class MediaStreamDeviceSettingsRequest : public MediaStreamRequest { | 83 class MediaStreamDeviceSettingsRequest : public MediaStreamRequest { |
84 public: | 84 public: |
85 MediaStreamDeviceSettingsRequest( | 85 MediaStreamDeviceSettingsRequest( |
86 int render_pid, | 86 int render_pid, |
87 int render_vid, | 87 int render_vid, |
88 const std::string& origin, | 88 const std::string& origin, |
89 const StreamOptions& request_options) | 89 const StreamOptions& request_options) |
90 : MediaStreamRequest(render_pid, render_vid, origin), | 90 : MediaStreamRequest(render_pid, render_vid, origin), |
91 options(request_options), | 91 options(request_options), |
92 posted_task(false) {} | 92 posted_task(false) {} |
93 | 93 |
94 ~MediaStreamDeviceSettingsRequest() {} | 94 ~MediaStreamDeviceSettingsRequest() {} |
95 | 95 |
96 // Request options. | 96 // Request options. |
97 StreamOptions options; | 97 StreamOptions options; |
98 // Map containing available devices for the requested capture types. | 98 // Map containing available devices for the requested capture types. |
99 DeviceMap devices_full; | 99 DeviceMap devices_full; |
100 // Whether or not a task was posted to make the call to | 100 // Whether or not a task was posted to make the call to |
101 // RequestMediaAccessPermission, to make sure that we never post twice to it. | 101 // RequestMediaAccessPermission, to make sure that we never post twice to it. |
102 bool posted_task; | 102 bool posted_task; |
103 }; | 103 }; |
104 | 104 |
105 typedef std::map<MediaStreamType, StreamDeviceInfoArray> DeviceMap; | |
106 | |
107 MediaStreamDeviceSettings::MediaStreamDeviceSettings( | 105 MediaStreamDeviceSettings::MediaStreamDeviceSettings( |
108 SettingsRequester* requester) | 106 SettingsRequester* requester) |
109 : requester_(requester), | 107 : requester_(requester), |
110 use_fake_ui_(false) { | 108 use_fake_ui_(false) { |
111 DCHECK(requester_); | 109 DCHECK(requester_); |
112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
113 } | 111 } |
114 | 112 |
115 MediaStreamDeviceSettings::~MediaStreamDeviceSettings() { | 113 MediaStreamDeviceSettings::~MediaStreamDeviceSettings() { |
116 STLDeleteValues(&requests_); | 114 STLDeleteValues(&requests_); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 delete req->second; | 250 delete req->second; |
253 requests_.erase(req); | 251 requests_.erase(req); |
254 } | 252 } |
255 | 253 |
256 void MediaStreamDeviceSettings::UseFakeUI() { | 254 void MediaStreamDeviceSettings::UseFakeUI() { |
257 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 255 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
258 use_fake_ui_ = true; | 256 use_fake_ui_ = true; |
259 } | 257 } |
260 | 258 |
261 } // namespace media_stream | 259 } // namespace media_stream |
OLD | NEW |