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

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

Issue 248113003: Fix for closing the desktop sharing notification bar when the shared window is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and add a test Created 6 years, 8 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 (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 <list> 7 #include <list>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 30 matching lines...) Expand all
41 #if defined(OS_WIN) 41 #if defined(OS_WIN)
42 #include "base/win/scoped_com_initializer.h" 42 #include "base/win/scoped_com_initializer.h"
43 #endif 43 #endif
44 44
45 namespace content { 45 namespace content {
46 46
47 // Forward declaration of DeviceMonitorMac and its only useable method. 47 // Forward declaration of DeviceMonitorMac and its only useable method.
48 class DeviceMonitorMac { 48 class DeviceMonitorMac {
49 public: 49 public:
50 void StartMonitoring( 50 void StartMonitoring(
51 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner); 51 const scoped_refptr<base::SingleThreadTaskRunner>& device_task_runner);
52 }; 52 };
53 53
54 namespace { 54 namespace {
55 // Creates a random label used to identify requests. 55 // Creates a random label used to identify requests.
56 std::string RandomLabel() { 56 std::string RandomLabel() {
57 // An earlier PeerConnection spec, 57 // An earlier PeerConnection spec,
58 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the 58 // http://dev.w3.org/2011/webrtc/editor/webrtc.html, specified the
59 // MediaStream::label alphabet as containing 36 characters from 59 // MediaStream::label alphabet as containing 36 characters from
60 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, 60 // range: U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E,
61 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. 61 // U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 PostRequestToUI(*it, request); 1600 PostRequestToUI(*it, request);
1601 } 1601 }
1602 break; 1602 break;
1603 } 1603 }
1604 } 1604 }
1605 label_list.clear(); 1605 label_list.clear();
1606 --active_enumeration_ref_count_[stream_type]; 1606 --active_enumeration_ref_count_[stream_type];
1607 DCHECK_GE(active_enumeration_ref_count_[stream_type], 0); 1607 DCHECK_GE(active_enumeration_ref_count_[stream_type], 0);
1608 } 1608 }
1609 1609
1610 void MediaStreamManager::Aborted(MediaStreamType stream_type,
1611 int capture_session_id) {
1612 DCHECK_CURRENTLY_ON(BrowserThread::IO);
1613 DVLOG(1) << "Aborted({stream_type = " << stream_type << "} "
1614 << "{capture_session_id = " << capture_session_id << "})";
1615
1616 for (DeviceRequests::iterator request_it = requests_.begin();
mcasas 2014/04/25 17:18:35 Why not calling directly StopDevice() ? Seems that
1617 request_it != requests_.end(); ++request_it) {
1618 DeviceRequest* request = request_it->second;
1619 StreamDeviceInfoArray* devices = &(request->devices);
1620
1621 for (StreamDeviceInfoArray::iterator device_it = devices->begin();
1622 device_it != devices->end(); ++device_it) {
1623 if (device_it->device.type == stream_type &&
1624 device_it->session_id == capture_session_id) {
1625 StopDevice(stream_type, capture_session_id);
1626 return;
1627 }
1628 }
1629 }
1630 NOTREACHED();
1631 }
1632
1610 // static 1633 // static
1611 void MediaStreamManager::SendMessageToNativeLog(const std::string& message) { 1634 void MediaStreamManager::SendMessageToNativeLog(const std::string& message) {
1612 BrowserThread::PostTask( 1635 BrowserThread::PostTask(
1613 BrowserThread::UI, FROM_HERE, 1636 BrowserThread::UI, FROM_HERE,
1614 base::Bind(DoAddLogMessage, message)); 1637 base::Bind(DoAddLogMessage, message));
1615 } 1638 }
1616 1639
1617 void MediaStreamManager::OnSuspend() { 1640 void MediaStreamManager::OnSuspend() {
1618 SendMessageToNativeLog("Power state suspended."); 1641 SendMessageToNativeLog("Power state suspended.");
1619 } 1642 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) { 1946 if (it->device.type == MEDIA_DESKTOP_VIDEO_CAPTURE) {
1924 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id, 1947 video_capture_manager_->SetDesktopCaptureWindowId(it->session_id,
1925 window_id); 1948 window_id);
1926 break; 1949 break;
1927 } 1950 }
1928 } 1951 }
1929 } 1952 }
1930 } 1953 }
1931 1954
1932 } // namespace content 1955 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698