| 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 #include "content/renderer/media/media_permission_dispatcher_impl.h" | 5 #include "content/renderer/media/media_permission_dispatcher_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "content/public/common/service_registry.h" | 10 #include "content/public/common/service_registry.h" |
| 11 #include "content/public/renderer/render_frame.h" | 11 #include "content/public/renderer/render_frame.h" |
| 12 #include "content/renderer/media/media_permission_dispatcher_proxy.h" | 12 #include "content/renderer/media/media_permission_dispatcher_proxy.h" |
| 13 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 13 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 using Type = media::MediaPermission::Type; | 18 using Type = media::MediaPermission::Type; |
| 19 | 19 |
| 20 content::PermissionName MediaPermissionTypeToPermissionName(Type type) { | 20 content::PermissionName MediaPermissionTypeToPermissionName(Type type) { |
| 21 switch (type) { | 21 switch (type) { |
| 22 case Type::PROTECTED_MEDIA_IDENTIFIER: | 22 case Type::PROTECTED_MEDIA_IDENTIFIER: |
| 23 return content::PERMISSION_NAME_PROTECTED_MEDIA_IDENTIFIER; | 23 return content::PermissionName::PROTECTED_MEDIA_IDENTIFIER; |
| 24 case Type::AUDIO_CAPTURE: | 24 case Type::AUDIO_CAPTURE: |
| 25 return content::PERMISSION_NAME_AUDIO_CAPTURE; | 25 return content::PermissionName::AUDIO_CAPTURE; |
| 26 case Type::VIDEO_CAPTURE: | 26 case Type::VIDEO_CAPTURE: |
| 27 return content::PERMISSION_NAME_VIDEO_CAPTURE; | 27 return content::PermissionName::VIDEO_CAPTURE; |
| 28 } | 28 } |
| 29 NOTREACHED(); | 29 NOTREACHED(); |
| 30 return content::PERMISSION_NAME_PROTECTED_MEDIA_IDENTIFIER; | 30 return content::PermissionName::PROTECTED_MEDIA_IDENTIFIER; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 namespace content { | 35 namespace content { |
| 36 | 36 |
| 37 MediaPermissionDispatcherImpl::MediaPermissionDispatcherImpl( | 37 MediaPermissionDispatcherImpl::MediaPermissionDispatcherImpl( |
| 38 RenderFrame* render_frame) | 38 RenderFrame* render_frame) |
| 39 : RenderFrameObserver(render_frame), | 39 : RenderFrameObserver(render_frame), |
| 40 task_runner_(base::ThreadTaskRunnerHandle::Get()), | 40 task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 scoped_ptr<media::MediaPermission> media_permission_proxy( | 86 scoped_ptr<media::MediaPermission> media_permission_proxy( |
| 87 new MediaPermissionDispatcherProxy(task_runner_, caller_task_runner, | 87 new MediaPermissionDispatcherProxy(task_runner_, caller_task_runner, |
| 88 weak_ptr_factory_.GetWeakPtr())); | 88 weak_ptr_factory_.GetWeakPtr())); |
| 89 return media_permission_proxy; | 89 return media_permission_proxy; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void MediaPermissionDispatcherImpl::OnPermissionStatus( | 92 void MediaPermissionDispatcherImpl::OnPermissionStatus( |
| 93 uint32_t request_id, | 93 uint32_t request_id, |
| 94 PermissionStatus status) { | 94 PermissionStatus status) { |
| 95 DCHECK(thread_checker().CalledOnValidThread()); | 95 DCHECK(thread_checker().CalledOnValidThread()); |
| 96 DeliverResult(request_id, status == PERMISSION_STATUS_GRANTED); | 96 DeliverResult(request_id, status == PermissionStatus::GRANTED); |
| 97 } | 97 } |
| 98 | 98 |
| 99 } // namespace content | 99 } // namespace content |
| OLD | NEW |