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

Side by Side Diff: chrome/browser/media/media_stream_device_permissions.cc

Issue 1286363002: Switch media stream permissions to use IsOriginSecure() instead of SchemeIsSecure(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits. Created 5 years, 4 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 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
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))
57 return true;
58
59 // We persist requests from extensions.
60 if (origin.SchemeIs(extensions::kExtensionScheme))
61 return true; 58 return true;
62 59
63 return false; 60 return false;
64 } 61 }
65 62
66 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile, 63 bool CheckAllowAllMediaStreamContentForOrigin(Profile* profile,
67 const GURL& security_origin, 64 const GURL& security_origin,
68 ContentSettingsType type) { 65 ContentSettingsType type) {
69 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || 66 DCHECK(type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
70 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
106 103
107 // 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
108 // 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"
109 // 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
110 // 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).
111 if (!prefs->GetBoolean(policy_name)) 108 if (!prefs->GetBoolean(policy_name))
112 return ALWAYS_DENY; 109 return ALWAYS_DENY;
113 110
114 return POLICY_NOT_SET; 111 return POLICY_NOT_SET;
115 } 112 }
OLDNEW
« no previous file with comments | « chrome/browser/media/desktop_capture_access_handler.cc ('k') | chrome/browser/media/media_stream_devices_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698