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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.h

Issue 502483002: Check policy when checking device access for enumerating devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added dchecks Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 virtual base::string16 GetMessageText() const OVERRIDE; 77 virtual base::string16 GetMessageText() const OVERRIDE;
78 virtual base::string16 GetMessageTextFragment() const OVERRIDE; 78 virtual base::string16 GetMessageTextFragment() const OVERRIDE;
79 virtual bool HasUserGesture() const OVERRIDE; 79 virtual bool HasUserGesture() const OVERRIDE;
80 virtual GURL GetRequestingHostname() const OVERRIDE; 80 virtual GURL GetRequestingHostname() const OVERRIDE;
81 virtual void PermissionGranted() OVERRIDE; 81 virtual void PermissionGranted() OVERRIDE;
82 virtual void PermissionDenied() OVERRIDE; 82 virtual void PermissionDenied() OVERRIDE;
83 virtual void Cancelled() OVERRIDE; 83 virtual void Cancelled() OVERRIDE;
84 virtual void RequestFinished() OVERRIDE; 84 virtual void RequestFinished() OVERRIDE;
85 85
86 private: 86 private:
87 enum DevicePolicy {
88 POLICY_NOT_SET,
89 ALWAYS_DENY,
90 ALWAYS_ALLOW,
91 };
92
93 // Called by GetAudioDevicePolicy and GetVideoDevicePolicy to check
94 // the currently set capture device policy.
95 DevicePolicy GetDevicePolicy(const char* policy_name,
96 const char* whitelist_policy_name) const;
97
98 // Returns true if the origin of the request has been granted the media 87 // Returns true if the origin of the request has been granted the media
99 // access before, otherwise returns false. 88 // access before, otherwise returns false.
100 bool IsRequestAllowedByDefault() const; 89 bool IsRequestAllowedByDefault() const;
101 90
102 // Check if any device of the request has been blocked for the origin of the 91 // Check if any device of the request has been blocked for the origin of the
103 // request and clears |microphone_requested_| or |webcam_requested_| flags if 92 // request and clears |microphone_requested_| or |webcam_requested_| flags if
104 // they are not allowed anymore. Returns the number of devices that are 93 // they are not allowed anymore. Returns the number of devices that are
105 // allowed after this step. If the count reaches zero the request can be 94 // allowed after this step. If the count reaches zero the request can be
106 // denied completely, else it still has to be partially fullfilled. 95 // denied completely, else it still has to be partially fullfilled.
107 int FilterBlockedByDefaultDevices(); 96 int FilterBlockedByDefaultDevices();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // passed to the tab specific content settings when the permissions have been 154 // passed to the tab specific content settings when the permissions have been
166 // resolved. Currently only used by MEDIA_DEVICE_AUDIO_CAPTURE and 155 // resolved. Currently only used by MEDIA_DEVICE_AUDIO_CAPTURE and
167 // MEDIA_DEVICE_VIDEO_CAPTURE since those are the only types that require 156 // MEDIA_DEVICE_VIDEO_CAPTURE since those are the only types that require
168 // updates in the settings. 157 // updates in the settings.
169 MediaStreamTypeSettingsMap request_permissions_; 158 MediaStreamTypeSettingsMap request_permissions_;
170 159
171 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); 160 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController);
172 }; 161 };
173 162
174 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ 163 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698