| 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_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 590 |
| 591 for (const StreamDeviceInfo& device_info : request->devices) { | 591 for (const StreamDeviceInfo& device_info : request->devices) { |
| 592 if (device_info.device.id == device_id) { | 592 if (device_info.device.id == device_id) { |
| 593 StopDevice(device_info.device.type, device_info.session_id); | 593 StopDevice(device_info.device.type, device_info.session_id); |
| 594 return; | 594 return; |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 int MediaStreamManager::VideoDeviceIdToSessionId( |
| 601 const std::string& device_id) const { |
| 602 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 603 |
| 604 for (const LabeledDeviceRequest& device_request : requests_) { |
| 605 for (const StreamDeviceInfo& info : device_request.second->devices) { |
| 606 if (info.device.id == device_id) { |
| 607 DCHECK_EQ(MEDIA_DEVICE_VIDEO_CAPTURE, info.device.type); |
| 608 return info.session_id; |
| 609 } |
| 610 } |
| 611 } |
| 612 return StreamDeviceInfo::kNoId; |
| 613 } |
| 614 |
| 600 void MediaStreamManager::StopDevice(MediaStreamType type, int session_id) { | 615 void MediaStreamManager::StopDevice(MediaStreamType type, int session_id) { |
| 601 DVLOG(1) << "StopDevice" | 616 DVLOG(1) << "StopDevice" |
| 602 << "{type = " << type << "}" | 617 << "{type = " << type << "}" |
| 603 << "{session_id = " << session_id << "}"; | 618 << "{session_id = " << session_id << "}"; |
| 604 DeviceRequests::iterator request_it = requests_.begin(); | 619 DeviceRequests::iterator request_it = requests_.begin(); |
| 605 while (request_it != requests_.end()) { | 620 while (request_it != requests_.end()) { |
| 606 DeviceRequest* request = request_it->second; | 621 DeviceRequest* request = request_it->second; |
| 607 StreamDeviceInfoArray* devices = &request->devices; | 622 StreamDeviceInfoArray* devices = &request->devices; |
| 608 if (devices->empty()) { | 623 if (devices->empty()) { |
| 609 // There is no device in use yet by this request. | 624 // There is no device in use yet by this request. |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2144 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( | 2159 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
| 2145 render_process_id, ConvertToGURL(origin))) { | 2160 render_process_id, ConvertToGURL(origin))) { |
| 2146 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use."; | 2161 LOG(ERROR) << "MSM: Renderer requested a URL it's not allowed to use."; |
| 2147 return false; | 2162 return false; |
| 2148 } | 2163 } |
| 2149 | 2164 |
| 2150 return true; | 2165 return true; |
| 2151 } | 2166 } |
| 2152 | 2167 |
| 2153 } // namespace content | 2168 } // namespace content |
| OLD | NEW |