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" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "components/content_settings/core/browser/host_content_settings_map.h" | 12 #include "components/content_settings/core/browser/host_content_settings_map.h" |
13 #include "components/content_settings/core/common/content_settings_pattern.h" | 13 #include "components/content_settings/core/common/content_settings_pattern.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/common/origin_util.h" | |
15 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
19 #include "components/user_manager/user_manager.h" | 20 #include "components/user_manager/user_manager.h" |
20 #endif | 21 #endif |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 bool IsInKioskMode() { | 25 bool IsInKioskMode() { |
(...skipping 21 matching lines...) Expand all Loading... | |
46 // It's safe to persist block settings all the time. | 47 // It's safe to persist block settings all the time. |
47 if (setting == CONTENT_SETTING_BLOCK) | 48 if (setting == CONTENT_SETTING_BLOCK) |
48 return true; | 49 return true; |
49 | 50 |
50 // Pepper requests should always be persisted to prevent annoying users of | 51 // Pepper requests should always be persisted to prevent annoying users of |
51 // plugins. | 52 // plugins. |
52 if (type == content::MEDIA_OPEN_DEVICE) | 53 if (type == content::MEDIA_OPEN_DEVICE) |
53 return true; | 54 return true; |
54 | 55 |
55 // We persist requests from secure origins. | 56 // We persist requests from secure origins. |
56 if (origin.SchemeIsSecure()) | 57 if (content::IsOriginSecure(origin)) |
raymes
2015/08/05 02:31:05
You might get a merge conflict (or not) as I recen
lgarron
2015/08/06 22:10:09
Done.
| |
57 return true; | 58 return true; |
58 | 59 |
59 return false; | 60 return false; |
60 } | 61 } |
61 | 62 |
62 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile, | 63 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile, |
63 const GURL& security_origin, | 64 const GURL& security_origin, |
64 ContentSettingsType type) { | 65 ContentSettingsType type) { |
65 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 66 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
66 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 67 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 | 103 |
103 // If a match was not found, check if audio capture is otherwise disallowed | 104 // If a match was not found, check if audio capture is otherwise disallowed |
104 // or if the user should be prompted. Setting the policy value to "true" | 105 // or if the user should be prompted. Setting the policy value to "true" |
105 // is equal to not setting it at all, so from hereon out, we will return | 106 // is equal to not setting it at all, so from hereon out, we will return |
106 // either POLICY_NOT_SET (prompt) or ALWAYS_DENY (no prompt, no access). | 107 // either POLICY_NOT_SET (prompt) or ALWAYS_DENY (no prompt, no access). |
107 if (!prefs->GetBoolean(policy_name)) | 108 if (!prefs->GetBoolean(policy_name)) |
108 return ALWAYS_DENY; | 109 return ALWAYS_DENY; |
109 | 110 |
110 return POLICY_NOT_SET; | 111 return POLICY_NOT_SET; |
111 } | 112 } |
OLD | NEW |