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

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

Issue 2829123003: Make media permission requests go through the PermissionManager (Closed)
Patch Set: Grouped requests Created 3 years, 7 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 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_stream_device_permission_context.h" 5 #include "chrome/browser/media/webrtc/media_stream_device_permission_context.h"
6 #include "base/feature_list.h"
6 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h" 7 #include "chrome/browser/media/webrtc/media_stream_device_permissions.h"
7 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/chrome_features.h"
8 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
9 #include "components/content_settings/core/browser/host_content_settings_map.h" 11 #include "components/content_settings/core/browser/host_content_settings_map.h"
10 #include "components/content_settings/core/common/content_settings.h" 12 #include "components/content_settings/core/common/content_settings.h"
11 #include "content/public/common/url_constants.h" 13 #include "content/public/common/url_constants.h"
12 #include "extensions/common/constants.h" 14 #include "extensions/common/constants.h"
13 15
14 MediaStreamDevicePermissionContext::MediaStreamDevicePermissionContext( 16 MediaStreamDevicePermissionContext::MediaStreamDevicePermissionContext(
15 Profile* profile, 17 Profile* profile,
16 const ContentSettingsType content_settings_type) 18 const ContentSettingsType content_settings_type)
17 : PermissionContextBase(profile, content_settings_type), 19 : PermissionContextBase(profile, content_settings_type),
18 content_settings_type_(content_settings_type) { 20 content_settings_type_(content_settings_type) {
19 DCHECK(content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || 21 DCHECK(content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
20 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 22 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
21 } 23 }
22 24
23 MediaStreamDevicePermissionContext::~MediaStreamDevicePermissionContext() {} 25 MediaStreamDevicePermissionContext::~MediaStreamDevicePermissionContext() {}
24 26
25 void MediaStreamDevicePermissionContext::RequestPermission( 27 void MediaStreamDevicePermissionContext::DecidePermission(
26 content::WebContents* web_contents, 28 content::WebContents* web_contents,
27 const PermissionRequestID& id, 29 const PermissionRequestID& id,
28 const GURL& requesting_frame, 30 const GURL& requesting_origin,
31 const GURL& embedding_origin,
29 bool user_gesture, 32 bool user_gesture,
30 const BrowserPermissionCallback& callback) { 33 const BrowserPermissionCallback& callback) {
31 NOTREACHED() << "RequestPermission is not implemented"; 34 DCHECK(base::FeatureList::IsEnabled(
32 callback.Run(CONTENT_SETTING_BLOCK); 35 features::kUsePermissionManagerForMediaRequests));
36 PermissionContextBase::DecidePermission(web_contents, id, requesting_origin,
37 embedding_origin, user_gesture,
38 callback);
33 } 39 }
34 40
35 ContentSetting MediaStreamDevicePermissionContext::GetPermissionStatusInternal( 41 ContentSetting MediaStreamDevicePermissionContext::GetPermissionStatusInternal(
36 content::RenderFrameHost* render_frame_host, 42 content::RenderFrameHost* render_frame_host,
37 const GURL& requesting_origin, 43 const GURL& requesting_origin,
38 const GURL& embedding_origin) const { 44 const GURL& embedding_origin) const {
39 // TODO(raymes): Merge this policy check into content settings 45 // TODO(raymes): Merge this policy check into content settings
40 // crbug.com/244389. 46 // crbug.com/244389.
41 const char* policy_name = nullptr; 47 const char* policy_name = nullptr;
42 const char* urls_policy_name = nullptr; 48 const char* urls_policy_name = nullptr;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const PermissionRequestID& id) { 89 const PermissionRequestID& id) {
84 NOTREACHED() << "CancelPermissionRequest is not implemented"; 90 NOTREACHED() << "CancelPermissionRequest is not implemented";
85 } 91 }
86 92
87 bool MediaStreamDevicePermissionContext::IsRestrictedToSecureOrigins() const { 93 bool MediaStreamDevicePermissionContext::IsRestrictedToSecureOrigins() const {
88 // Flash currently doesn't require secure origin to use mic/camera. If we 94 // Flash currently doesn't require secure origin to use mic/camera. If we
89 // return true here, it'll break the use case like http://tinychat.com. 95 // return true here, it'll break the use case like http://tinychat.com.
90 // TODO(raymes): Change this to true after crbug.com/526324 is fixed. 96 // TODO(raymes): Change this to true after crbug.com/526324 is fixed.
91 return false; 97 return false;
92 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698