OLD | NEW |
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 // MediaPermission implementation which dispatches queries/requests to Mojo | 5 // MediaPermission implementation which dispatches queries/requests to Mojo |
6 // PermissionService. It relies on its base class MediaPermissionDispatcher to | 6 // PermissionService. It relies on its base class MediaPermissionDispatcher to |
7 // manage pending callbacks. Non-UI threads could create | 7 // manage pending callbacks. Non-UI threads could create |
8 // MediaPermissionDispatcherProxy by calling CreateProxy such that calls will be | 8 // MediaPermissionDispatcherProxy by calling CreateProxy such that calls will be |
9 // executed on the UI thread which is where this object lives. | 9 // executed on the UI thread which is where this object lives. |
10 | 10 |
11 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ | 11 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ |
12 #define CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ | 12 #define CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 | 15 |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "components/permission/public/interfaces/permission.mojom.h" |
18 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
19 #include "content/common/permission_service.mojom.h" | |
20 #include "content/public/renderer/render_frame_observer.h" | 20 #include "content/public/renderer/render_frame_observer.h" |
21 #include "content/renderer/media/media_permission_dispatcher.h" | 21 #include "content/renderer/media/media_permission_dispatcher.h" |
22 #include "media/base/media_permission.h" | 22 #include "media/base/media_permission.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class CONTENT_EXPORT MediaPermissionDispatcherImpl | 26 class CONTENT_EXPORT MediaPermissionDispatcherImpl |
27 : public MediaPermissionDispatcher, | 27 : public MediaPermissionDispatcher, |
28 public RenderFrameObserver { | 28 public RenderFrameObserver { |
29 public: | 29 public: |
(...skipping 13 matching lines...) Expand all Loading... |
43 const PermissionStatusCB& permission_status_cb) override; | 43 const PermissionStatusCB& permission_status_cb) override; |
44 | 44 |
45 // Create MediaPermissionDispatcherProxy object which will dispatch the | 45 // Create MediaPermissionDispatcherProxy object which will dispatch the |
46 // callback between the |caller_task_runner| and |task_runner_| in a thread | 46 // callback between the |caller_task_runner| and |task_runner_| in a thread |
47 // safe way. This can be called from non-UI thread. | 47 // safe way. This can be called from non-UI thread. |
48 scoped_ptr<media::MediaPermission> CreateProxy( | 48 scoped_ptr<media::MediaPermission> CreateProxy( |
49 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner); | 49 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner); |
50 | 50 |
51 private: | 51 private: |
52 // Callback for |permission_service_| calls. | 52 // Callback for |permission_service_| calls. |
53 void OnPermissionStatus(uint32_t request_id, PermissionStatus status); | 53 void OnPermissionStatus(uint32_t request_id, permission::Status status); |
54 | 54 |
55 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 55 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
56 | 56 |
57 PermissionServicePtr permission_service_; | 57 permission::PermissionServicePtr permission_service_; |
58 | 58 |
59 base::WeakPtrFactory<MediaPermissionDispatcherImpl> weak_ptr_factory_; | 59 base::WeakPtrFactory<MediaPermissionDispatcherImpl> weak_ptr_factory_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(MediaPermissionDispatcherImpl); | 61 DISALLOW_COPY_AND_ASSIGN(MediaPermissionDispatcherImpl); |
62 }; | 62 }; |
63 | 63 |
64 } // namespace content | 64 } // namespace content |
65 | 65 |
66 #endif // CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ | 66 #endif // CONTENT_RENDERER_MEDIA_MEDIA_PERMISSION_DISPATCHER_IMPL_H_ |
OLD | NEW |