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 29 matching lines...) Expand all Loading... |
40 // Checks if the origin |security_origin| associated to a render frame | 40 // Checks if the origin |security_origin| associated to a render frame |
41 // identified by |render_process_id| and |render_frame_id| is allowed to | 41 // identified by |render_process_id| and |render_frame_id| is allowed to |
42 // access the media device type |device_type|. The result is passed to | 42 // access the media device type |device_type|. The result is passed to |
43 // |callback|. | 43 // |callback|. |
44 // This method can be called on any thread. |callback| is fired on the same | 44 // This method can be called on any thread. |callback| is fired on the same |
45 // thread this method is called on. | 45 // thread this method is called on. |
46 void CheckPermission(MediaDeviceType device_type, | 46 void CheckPermission(MediaDeviceType device_type, |
47 int render_process_id, | 47 int render_process_id, |
48 int render_frame_id, | 48 int render_frame_id, |
49 const url::Origin& security_origin, | 49 const url::Origin& security_origin, |
50 const base::Callback<void(bool)>& callback) const; | 50 base::OnceCallback<void(bool)> callback) const; |
51 | 51 |
52 // Checks if the origin |security_origin| associated to a render frame | 52 // Checks if the origin |security_origin| associated to a render frame |
53 // identified by |render_process_id| and |render_frame_id| is allowed to | 53 // identified by |render_process_id| and |render_frame_id| is allowed to |
54 // access the media device types marked with a value of true in | 54 // access the media device types marked with a value of true in |
55 // |requested_device_types|. The result is passed to |callback|. The result is | 55 // |requested_device_types|. The result is passed to |callback|. The result is |
56 // indexed by MediaDeviceType. Entries in the result with a value of true for | 56 // indexed by MediaDeviceType. Entries in the result with a value of true for |
57 // requested device types indicate that the frame has permission to access | 57 // requested device types indicate that the frame has permission to access |
58 // devices of the corresponding types. | 58 // devices of the corresponding types. |
59 // This method can be called on any thread. |callback| is fired on the same | 59 // This method can be called on any thread. |callback| is fired on the same |
60 // thread this method is called on. | 60 // thread this method is called on. |
61 void CheckPermissions( | 61 void CheckPermissions( |
62 MediaDevicesManager::BoolDeviceTypes requested_device_types, | 62 MediaDevicesManager::BoolDeviceTypes requested_device_types, |
63 int render_process_id, | 63 int render_process_id, |
64 int render_frame_id, | 64 int render_frame_id, |
65 const url::Origin& security_origin, | 65 const url::Origin& security_origin, |
66 const base::Callback<void(const MediaDevicesManager::BoolDeviceTypes&)>& | 66 base::OnceCallback<void(const MediaDevicesManager::BoolDeviceTypes&)> |
67 callback) const; | 67 callback) const; |
68 | 68 |
69 private: | 69 private: |
70 const bool use_override_; | 70 const bool use_override_; |
71 const bool override_value_; | 71 const bool override_value_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(MediaDevicesPermissionChecker); | 73 DISALLOW_COPY_AND_ASSIGN(MediaDevicesPermissionChecker); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace content | 76 } // namespace content |
77 | 77 |
78 #endif // CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ | 78 #endif // CONTENT_BROWSER_MEDIA_MEDIA_DEVICES_PERMISSION_CHECKER_H_ |
OLD | NEW |