| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 int render_frame_id) const; | 33 int render_frame_id) const; |
| 34 | 34 |
| 35 // Checks if the origin associated to a render frame identified by | 35 // Checks if the origin associated to a render frame identified by |
| 36 // |render_process_id| and |render_frame_id| is allowed to access the media | 36 // |render_process_id| and |render_frame_id| is allowed to access the media |
| 37 // device type |device_type|. The result is passed to |callback|. | 37 // device type |device_type|. The result is passed to |callback|. |
| 38 // This method can be called on any thread. |callback| is fired on the same | 38 // This method can be called on any thread. |callback| is fired on the same |
| 39 // thread this method is called on. | 39 // thread this method is called on. |
| 40 void CheckPermission(MediaDeviceType device_type, | 40 void CheckPermission(MediaDeviceType device_type, |
| 41 int render_process_id, | 41 int render_process_id, |
| 42 int render_frame_id, | 42 int render_frame_id, |
| 43 const base::Callback<void(bool)>& callback) const; | 43 base::OnceCallback<void(bool)> callback) const; |
| 44 | 44 |
| 45 // Checks if the origin associated to a render frame identified by | 45 // Checks if the origin associated to a render frame identified by |
| 46 // |render_process_id| and |render_frame_id| is allowed to access the media | 46 // |render_process_id| and |render_frame_id| is allowed to access the media |
| 47 // device types marked with a value of true in |requested_device_types|. The | 47 // device types marked with a value of true in |requested_device_types|. The |
| 48 // result is passed to |callback|. The result is indexed by MediaDeviceType. | 48 // result is passed to |callback|. The result is indexed by MediaDeviceType. |
| 49 // Entries in the result with a value of true for requested device types | 49 // Entries in the result with a value of true for requested device types |
| 50 // indicate that the frame has permission to access devices of the | 50 // indicate that the frame has permission to access devices of the |
| 51 // corresponding types. | 51 // corresponding types. |
| 52 // This method can be called on any thread. |callback| is fired on the same | 52 // This method can be called on any thread. |callback| is fired on the same |
| 53 // thread this method is called on. | 53 // thread this method is called on. |
| 54 void CheckPermissions( | 54 void CheckPermissions( |
| 55 MediaDevicesManager::BoolDeviceTypes requested_device_types, | 55 MediaDevicesManager::BoolDeviceTypes requested_device_types, |
| 56 int render_process_id, | 56 int render_process_id, |
| 57 int render_frame_id, | 57 int render_frame_id, |
| 58 const base::Callback<void(const MediaDevicesManager::BoolDeviceTypes&)>& | 58 base::OnceCallback<void(const MediaDevicesManager::BoolDeviceTypes&)> |
| 59 callback) const; | 59 callback) const; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 const bool use_override_; | 62 const bool use_override_; |
| 63 const bool override_value_; | 63 const bool override_value_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(MediaDevicesPermissionChecker); | 65 DISALLOW_COPY_AND_ASSIGN(MediaDevicesPermissionChecker); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace content | 68 } // namespace content |
| 69 | 69 |
| 70 #endif // CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ | 70 #endif // CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ |
| OLD | NEW |