| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h" | 5 #include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "chrome/browser/media/webrtc/media_permission.h" | 10 #include "chrome/browser/media/webrtc/media_permission.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // possible use after free. | 50 // possible use after free. |
| 51 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 51 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 52 notifications_registrar_.Add(this, | 52 notifications_registrar_.Add(this, |
| 53 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 53 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 54 content::NotificationService::AllSources()); | 54 content::NotificationService::AllSources()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 PermissionBubbleMediaAccessHandler::~PermissionBubbleMediaAccessHandler() {} | 57 PermissionBubbleMediaAccessHandler::~PermissionBubbleMediaAccessHandler() {} |
| 58 | 58 |
| 59 bool PermissionBubbleMediaAccessHandler::SupportsStreamType( | 59 bool PermissionBubbleMediaAccessHandler::SupportsStreamType( |
| 60 content::WebContents* web_contents, |
| 60 const content::MediaStreamType type, | 61 const content::MediaStreamType type, |
| 61 const extensions::Extension* extension) { | 62 const extensions::Extension* extension) { |
| 62 #if defined(OS_ANDROID) | 63 #if defined(OS_ANDROID) |
| 63 return type == content::MEDIA_DEVICE_VIDEO_CAPTURE || | 64 return type == content::MEDIA_DEVICE_VIDEO_CAPTURE || |
| 64 type == content::MEDIA_DEVICE_AUDIO_CAPTURE || | 65 type == content::MEDIA_DEVICE_AUDIO_CAPTURE || |
| 65 type == content::MEDIA_DESKTOP_VIDEO_CAPTURE; | 66 type == content::MEDIA_DESKTOP_VIDEO_CAPTURE; |
| 66 #else | 67 #else |
| 67 return type == content::MEDIA_DEVICE_VIDEO_CAPTURE || | 68 return type == content::MEDIA_DEVICE_VIDEO_CAPTURE || |
| 68 type == content::MEDIA_DEVICE_AUDIO_CAPTURE; | 69 type == content::MEDIA_DEVICE_AUDIO_CAPTURE; |
| 69 #endif | 70 #endif |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 212 |
| 212 void PermissionBubbleMediaAccessHandler::Observe( | 213 void PermissionBubbleMediaAccessHandler::Observe( |
| 213 int type, | 214 int type, |
| 214 const content::NotificationSource& source, | 215 const content::NotificationSource& source, |
| 215 const content::NotificationDetails& details) { | 216 const content::NotificationDetails& details) { |
| 216 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 217 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 217 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); | 218 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); |
| 218 | 219 |
| 219 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); | 220 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); |
| 220 } | 221 } |
| OLD | NEW |