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

Side by Side Diff: content/browser/renderer_host/media/media_devices_manager.cc

Issue 2609863004: Pass camera facing to WebKit (Closed)
Patch Set: modify settings names Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_devices_manager.h" 5 #include "content/browser/renderer_host/media/media_devices_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 is_input), 378 is_input),
379 base::Bind(&MediaDevicesManager::DevicesEnumerated, 379 base::Bind(&MediaDevicesManager::DevicesEnumerated,
380 weak_factory_.GetWeakPtr(), type)); 380 weak_factory_.GetWeakPtr(), type));
381 } 381 }
382 382
383 void MediaDevicesManager::VideoInputDevicesEnumerated( 383 void MediaDevicesManager::VideoInputDevicesEnumerated(
384 const media::VideoCaptureDeviceDescriptors& descriptors) { 384 const media::VideoCaptureDeviceDescriptors& descriptors) {
385 DCHECK_CURRENTLY_ON(BrowserThread::IO); 385 DCHECK_CURRENTLY_ON(BrowserThread::IO);
386 MediaDeviceInfoArray snapshot; 386 MediaDeviceInfoArray snapshot;
387 for (const auto& descriptor : descriptors) { 387 for (const auto& descriptor : descriptors) {
388 snapshot.emplace_back(descriptor.device_id, descriptor.GetNameAndModel(), 388 snapshot.emplace_back(descriptor);
miu 2017/01/05 21:55:33 nit: push_back() would be more appropriate here.
shenghao 2017/01/06 09:43:01 Why? If using push_back(), I will need to create a
miu 2017/01/10 22:14:23 push_back() takes a const-ref argument (or an rval
shenghao 2017/01/11 12:00:53 Actually, |snapshot| is a vector of MediaDeviceInf
miu 2017/01/11 21:08:44 OIC! Okay then, sounds good to me. :)
389 std::string());
390 } 389 }
mcasas 2017/01/05 20:26:37 No {} for one-line bodies.
shenghao 2017/01/06 09:43:01 Done.
391 DevicesEnumerated(MEDIA_DEVICE_TYPE_VIDEO_INPUT, snapshot); 390 DevicesEnumerated(MEDIA_DEVICE_TYPE_VIDEO_INPUT, snapshot);
392 } 391 }
393 392
394 void MediaDevicesManager::DevicesEnumerated( 393 void MediaDevicesManager::DevicesEnumerated(
395 MediaDeviceType type, 394 MediaDeviceType type,
396 const MediaDeviceInfoArray& snapshot) { 395 const MediaDeviceInfoArray& snapshot) {
397 DCHECK_CURRENTLY_ON(BrowserThread::IO); 396 DCHECK_CURRENTLY_ON(BrowserThread::IO);
398 DCHECK(IsValidMediaDeviceType(type)); 397 DCHECK(IsValidMediaDeviceType(type));
399 UpdateSnapshot(type, snapshot); 398 UpdateSnapshot(type, snapshot);
400 cache_infos_[type].UpdateCompleted(); 399 cache_infos_[type].UpdateCompleted();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 const MediaDeviceInfoArray& snapshot) { 519 const MediaDeviceInfoArray& snapshot) {
521 DCHECK_CURRENTLY_ON(BrowserThread::IO); 520 DCHECK_CURRENTLY_ON(BrowserThread::IO);
522 DCHECK(IsValidMediaDeviceType(type)); 521 DCHECK(IsValidMediaDeviceType(type));
523 522
524 for (const auto& subscriber : device_change_subscribers_[type]) { 523 for (const auto& subscriber : device_change_subscribers_[type]) {
525 subscriber->OnDevicesChanged(type, snapshot); 524 subscriber->OnDevicesChanged(type, snapshot);
526 } 525 }
527 } 526 }
528 527
529 } // namespace content 528 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698