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

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

Issue 2110343002: Reintroduce plumbing for user gesture into permission system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 5 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/media_stream_device_permission_context.h" 5 #include "chrome/browser/media/media_stream_device_permission_context.h"
6 #include "chrome/browser/media/media_stream_device_permissions.h" 6 #include "chrome/browser/media/media_stream_device_permissions.h"
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
9 #include "components/content_settings/core/browser/host_content_settings_map.h" 9 #include "components/content_settings/core/browser/host_content_settings_map.h"
10 #include "components/content_settings/core/common/content_settings.h" 10 #include "components/content_settings/core/common/content_settings.h"
11 #include "content/public/common/url_constants.h" 11 #include "content/public/common/url_constants.h"
12 #include "extensions/common/constants.h" 12 #include "extensions/common/constants.h"
13 13
14 MediaStreamDevicePermissionContext::MediaStreamDevicePermissionContext( 14 MediaStreamDevicePermissionContext::MediaStreamDevicePermissionContext(
15 Profile* profile, 15 Profile* profile,
16 const content::PermissionType permission_type, 16 const content::PermissionType permission_type,
17 const ContentSettingsType content_settings_type) 17 const ContentSettingsType content_settings_type)
18 : PermissionContextBase(profile, permission_type, content_settings_type), 18 : PermissionContextBase(profile, permission_type, content_settings_type),
19 content_settings_type_(content_settings_type) { 19 content_settings_type_(content_settings_type) {
20 DCHECK(content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || 20 DCHECK(content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
21 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 21 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
22 } 22 }
23 23
24 MediaStreamDevicePermissionContext::~MediaStreamDevicePermissionContext() {} 24 MediaStreamDevicePermissionContext::~MediaStreamDevicePermissionContext() {}
25 25
26 void MediaStreamDevicePermissionContext::RequestPermission( 26 void MediaStreamDevicePermissionContext::RequestPermission(
27 content::WebContents* web_contents, 27 content::WebContents* web_contents,
28 const PermissionRequestID& id, 28 const PermissionRequestID& id,
29 const GURL& requesting_frame, 29 const GURL& requesting_frame,
30 bool user_gesture,
30 const BrowserPermissionCallback& callback) { 31 const BrowserPermissionCallback& callback) {
31 NOTREACHED() << "RequestPermission is not implemented"; 32 NOTREACHED() << "RequestPermission is not implemented";
32 callback.Run(CONTENT_SETTING_BLOCK); 33 callback.Run(CONTENT_SETTING_BLOCK);
33 } 34 }
34 35
35 ContentSetting MediaStreamDevicePermissionContext::GetPermissionStatus( 36 ContentSetting MediaStreamDevicePermissionContext::GetPermissionStatus(
36 const GURL& requesting_origin, 37 const GURL& requesting_origin,
37 const GURL& embedding_origin) const { 38 const GURL& embedding_origin) const {
38 // TODO(raymes): Merge this policy check into content settings 39 // TODO(raymes): Merge this policy check into content settings
39 // crbug.com/244389. 40 // crbug.com/244389.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const PermissionRequestID& id) { 83 const PermissionRequestID& id) {
83 NOTREACHED() << "CancelPermissionRequest is not implemented"; 84 NOTREACHED() << "CancelPermissionRequest is not implemented";
84 } 85 }
85 86
86 bool MediaStreamDevicePermissionContext::IsRestrictedToSecureOrigins() const { 87 bool MediaStreamDevicePermissionContext::IsRestrictedToSecureOrigins() const {
87 // Flash currently doesn't require secure origin to use mic/camera. If we 88 // Flash currently doesn't require secure origin to use mic/camera. If we
88 // return true here, it'll break the use case like http://tinychat.com. 89 // return true here, it'll break the use case like http://tinychat.com.
89 // TODO(raymes): Change this to true after crbug.com/526324 is fixed. 90 // TODO(raymes): Change this to true after crbug.com/526324 is fixed.
90 return false; 91 return false;
91 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698