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

Side by Side Diff: chrome/browser/media/webrtc/media_permission.cc

Issue 2753013002: DCHECK that the security origin for a media request isn't empty (Closed)
Patch Set: DCHECK that the security origin for a media request isn't empty Created 3 years, 8 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
« no previous file with comments | « no previous file | content/public/common/media_stream_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/media_permission.h" 5 #include "chrome/browser/media/webrtc/media_permission.h"
6 6
7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" 7 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" 8 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
9 #include "chrome/browser/permissions/permission_context_base.h" 9 #include "chrome/browser/permissions/permission_context_base.h"
10 #include "chrome/browser/permissions/permission_manager.h" 10 #include "chrome/browser/permissions/permission_manager.h"
(...skipping 23 matching lines...) Expand all
34 embedding_origin_(embedding_origin), 34 embedding_origin_(embedding_origin),
35 profile_(profile), 35 profile_(profile),
36 web_contents_(web_contents) { 36 web_contents_(web_contents) {
37 // Currently |web_contents_| is only used on ChromeOS but it's not worth 37 // Currently |web_contents_| is only used on ChromeOS but it's not worth
38 // #ifdef'ing out all its usage, so just mark it used here. 38 // #ifdef'ing out all its usage, so just mark it used here.
39 (void)web_contents_; 39 (void)web_contents_;
40 } 40 }
41 41
42 ContentSetting MediaPermission::GetPermissionStatus( 42 ContentSetting MediaPermission::GetPermissionStatus(
43 content::MediaStreamRequestResult* denial_reason) const { 43 content::MediaStreamRequestResult* denial_reason) const {
44 // Deny the request if the security origin is empty, this happens with 44 DCHECK(!requesting_origin_.is_empty());
45 // file access without |--allow-file-access-from-files| flag.
46 if (requesting_origin_.is_empty()) {
47 *denial_reason = content::MEDIA_DEVICE_INVALID_SECURITY_ORIGIN;
48 return CONTENT_SETTING_BLOCK;
49 }
50 45
51 PermissionManager* permission_manager = PermissionManager::Get(profile_); 46 PermissionManager* permission_manager = PermissionManager::Get(profile_);
52 47
53 // Find out if the kill switch is on. Set the denial reason to kill switch. 48 // Find out if the kill switch is on. Set the denial reason to kill switch.
54 if (permission_manager->IsPermissionKillSwitchOn(content_type_)) { 49 if (permission_manager->IsPermissionKillSwitchOn(content_type_)) {
55 *denial_reason = content::MEDIA_DEVICE_KILL_SWITCH_ON; 50 *denial_reason = content::MEDIA_DEVICE_KILL_SWITCH_ON;
56 return CONTENT_SETTING_BLOCK; 51 return CONTENT_SETTING_BLOCK;
57 } 52 }
58 53
59 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // Check policy and content settings. 110 // Check policy and content settings.
116 ContentSetting content_setting = 111 ContentSetting content_setting =
117 permission_manager 112 permission_manager
118 ->GetPermissionStatus(content_type_, requesting_origin_, 113 ->GetPermissionStatus(content_type_, requesting_origin_,
119 embedding_origin_) 114 embedding_origin_)
120 .content_setting; 115 .content_setting;
121 if (content_setting == CONTENT_SETTING_BLOCK) 116 if (content_setting == CONTENT_SETTING_BLOCK)
122 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED; 117 *denial_reason = content::MEDIA_DEVICE_PERMISSION_DENIED;
123 return content_setting; 118 return content_setting;
124 } 119 }
OLDNEW
« no previous file with comments | « no previous file | content/public/common/media_stream_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698