| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media_stream_device_permissions.h" | 5 #include "chrome/browser/media/media_stream_device_permissions.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 user_manager::UserManager::Get(); | 29 user_manager::UserManager::Get(); |
| 30 return user_manager && user_manager->IsLoggedInAsKioskApp(); | 30 return user_manager && user_manager->IsLoggedInAsKioskApp(); |
| 31 #else | 31 #else |
| 32 return false; | 32 return false; |
| 33 #endif | 33 #endif |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile, | 38 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile, |
| 39 const GURL& security_origin) { | 39 const GURL& security_origin, |
| 40 // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the | 40 ContentSettingsType type) { |
| 41 // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and | 41 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| 42 // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. | 42 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 43 return profile->GetHostContentSettingsMap()->ShouldAllowAllContent( | 43 return profile->GetHostContentSettingsMap()->ShouldAllowAllContent( |
| 44 security_origin, security_origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM); | 44 security_origin, security_origin, type); |
| 45 } | 45 } |
| 46 | 46 |
| 47 MediaStreamDevicePolicy GetDevicePolicy(Profile* profile, | 47 MediaStreamDevicePolicy GetDevicePolicy(Profile* profile, |
| 48 const GURL& security_origin, | 48 const GURL& security_origin, |
| 49 const char* policy_name, | 49 const char* policy_name, |
| 50 const char* whitelist_policy_name) { | 50 const char* whitelist_policy_name) { |
| 51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 51 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 52 | 52 |
| 53 // If the security origin policy matches a value in the whitelist, allow it. | 53 // If the security origin policy matches a value in the whitelist, allow it. |
| 54 // Otherwise, check the |policy_name| master switch for the default behavior. | 54 // Otherwise, check the |policy_name| master switch for the default behavior. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 // If a match was not found, check if audio capture is otherwise disallowed | 79 // If a match was not found, check if audio capture is otherwise disallowed |
| 80 // or if the user should be prompted. Setting the policy value to "true" | 80 // or if the user should be prompted. Setting the policy value to "true" |
| 81 // is equal to not setting it at all, so from hereon out, we will return | 81 // is equal to not setting it at all, so from hereon out, we will return |
| 82 // either POLICY_NOT_SET (prompt) or ALWAYS_DENY (no prompt, no access). | 82 // either POLICY_NOT_SET (prompt) or ALWAYS_DENY (no prompt, no access). |
| 83 if (!prefs->GetBoolean(policy_name)) | 83 if (!prefs->GetBoolean(policy_name)) |
| 84 return ALWAYS_DENY; | 84 return ALWAYS_DENY; |
| 85 | 85 |
| 86 return POLICY_NOT_SET; | 86 return POLICY_NOT_SET; |
| 87 } | 87 } |
| OLD | NEW |