| OLD | NEW |
| 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 "chrome/browser/media/public_session_media_access_handler.h" | 5 #include "chrome/browser/media/public_session_media_access_handler.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" | 13 #include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" |
| 14 #include "chrome/browser/profiles/profiles_state.h" | 14 #include "chrome/browser/profiles/profiles_state.h" |
| 15 #include "chromeos/login/login_state.h" | 15 #include "chromeos/login/login_state.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 18 #include "extensions/common/permissions/manifest_permission_set.h" | 18 #include "extensions/common/permissions/manifest_permission_set.h" |
| 19 #include "extensions/common/permissions/permission_set.h" | 19 #include "extensions/common/permissions/permission_set.h" |
| 20 #include "extensions/common/url_pattern_set.h" | 20 #include "extensions/common/url_pattern_set.h" |
| 21 | 21 |
| 22 PublicSessionMediaAccessHandler::PublicSessionMediaAccessHandler() {} | 22 PublicSessionMediaAccessHandler::PublicSessionMediaAccessHandler() {} |
| 23 | 23 |
| 24 PublicSessionMediaAccessHandler::~PublicSessionMediaAccessHandler() {} | 24 PublicSessionMediaAccessHandler::~PublicSessionMediaAccessHandler() {} |
| 25 | 25 |
| 26 bool PublicSessionMediaAccessHandler::SupportsStreamType( | 26 bool PublicSessionMediaAccessHandler::SupportsStreamType( |
| 27 content::WebContents* web_contents, |
| 27 const content::MediaStreamType type, | 28 const content::MediaStreamType type, |
| 28 const extensions::Extension* extension) { | 29 const extensions::Extension* extension) { |
| 29 return extension_media_access_handler_.SupportsStreamType(type, extension); | 30 return extension_media_access_handler_.SupportsStreamType(web_contents, type, |
| 31 extension); |
| 30 } | 32 } |
| 31 | 33 |
| 32 bool PublicSessionMediaAccessHandler::CheckMediaAccessPermission( | 34 bool PublicSessionMediaAccessHandler::CheckMediaAccessPermission( |
| 33 content::WebContents* web_contents, | 35 content::WebContents* web_contents, |
| 34 const GURL& security_origin, | 36 const GURL& security_origin, |
| 35 content::MediaStreamType type, | 37 content::MediaStreamType type, |
| 36 const extensions::Extension* extension) { | 38 const extensions::Extension* extension) { |
| 37 return extension_media_access_handler_.CheckMediaAccessPermission( | 39 return extension_media_access_handler_.CheckMediaAccessPermission( |
| 38 web_contents, security_origin, type, extension); | 40 web_contents, security_origin, type, extension); |
| 39 } | 41 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // the request before being passed on to the actual implementation. | 81 // the request before being passed on to the actual implementation. |
| 80 if (!allowed_permissions.ContainsID(extensions::APIPermission::kAudioCapture)) | 82 if (!allowed_permissions.ContainsID(extensions::APIPermission::kAudioCapture)) |
| 81 request_copy.audio_type = content::MEDIA_NO_SERVICE; | 83 request_copy.audio_type = content::MEDIA_NO_SERVICE; |
| 82 if (!allowed_permissions.ContainsID(extensions::APIPermission::kVideoCapture)) | 84 if (!allowed_permissions.ContainsID(extensions::APIPermission::kVideoCapture)) |
| 83 request_copy.video_type = content::MEDIA_NO_SERVICE; | 85 request_copy.video_type = content::MEDIA_NO_SERVICE; |
| 84 | 86 |
| 85 // Pass the request through to the original class. | 87 // Pass the request through to the original class. |
| 86 extension_media_access_handler_.HandleRequest(web_contents, request_copy, | 88 extension_media_access_handler_.HandleRequest(web_contents, request_copy, |
| 87 callback, extension); | 89 callback, extension); |
| 88 } | 90 } |
| OLD | NEW |