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 // MediaStreamManager is used to open/enumerate media capture devices (video | 5 // MediaStreamManager is used to open/enumerate media capture devices (video |
6 // supported now). Call flow: | 6 // supported now). Call flow: |
7 // 1. GenerateStream is called when a render process wants to use a capture | 7 // 1. GenerateStream is called when a render process wants to use a capture |
8 // device. | 8 // device. |
9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to | 9 // 2. MediaStreamManager will ask MediaStreamUIController for permission to |
10 // use devices and for which device to use. | 10 // use devices and for which device to use. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void AddLogMessageOnIOThread(const std::string& message); | 206 void AddLogMessageOnIOThread(const std::string& message); |
207 | 207 |
208 // base::PowerObserver overrides. | 208 // base::PowerObserver overrides. |
209 void OnSuspend() override; | 209 void OnSuspend() override; |
210 void OnResume() override; | 210 void OnResume() override; |
211 | 211 |
212 // Called by the tests to specify a fake UI that should be used for next | 212 // Called by the tests to specify a fake UI that should be used for next |
213 // generated stream (or when using --use-fake-ui-for-media-stream). | 213 // generated stream (or when using --use-fake-ui-for-media-stream). |
214 void UseFakeUIForTests(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); | 214 void UseFakeUIForTests(scoped_ptr<FakeMediaStreamUIProxy> fake_ui); |
215 | 215 |
| 216 // Generates a hash of a device's unique ID usable by one |
| 217 // particular security origin. |
| 218 static std::string GetHMACForMediaDeviceID( |
| 219 const ResourceContext::SaltCallback& sc, |
| 220 const GURL& security_origin, |
| 221 const std::string& raw_unique_id); |
| 222 |
| 223 // Convenience method to check if |device_guid| is an HMAC of |
| 224 // |raw_device_id| for |security_origin|. |
| 225 static bool DoesMediaDeviceIDMatchHMAC( |
| 226 const ResourceContext::SaltCallback& sc, |
| 227 const GURL& security_origin, |
| 228 const std::string& device_guid, |
| 229 const std::string& raw_unique_id); |
| 230 |
216 private: | 231 private: |
217 // Contains all data needed to keep track of requests. | 232 // Contains all data needed to keep track of requests. |
218 class DeviceRequest; | 233 class DeviceRequest; |
219 | 234 |
220 // Cache enumerated device list. | 235 // Cache enumerated device list. |
221 struct EnumerationCache { | 236 struct EnumerationCache { |
222 EnumerationCache(); | 237 EnumerationCache(); |
223 ~EnumerationCache(); | 238 ~EnumerationCache(); |
224 | 239 |
225 bool valid; | 240 bool valid; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 420 |
406 bool use_fake_ui_; | 421 bool use_fake_ui_; |
407 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; | 422 scoped_ptr<FakeMediaStreamUIProxy> fake_ui_; |
408 | 423 |
409 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); | 424 DISALLOW_COPY_AND_ASSIGN(MediaStreamManager); |
410 }; | 425 }; |
411 | 426 |
412 } // namespace content | 427 } // namespace content |
413 | 428 |
414 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ | 429 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_MANAGER_H_ |
OLD | NEW |