| 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 #include "content/browser/media/session/media_session_service_impl.h" | 5 #include "content/browser/media/session/media_session_service_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/media/session/media_metadata_sanitizer.h" | 7 #include "content/browser/media/session/media_metadata_sanitizer.h" |
| 8 #include "content/browser/media/session/media_session.h" | 8 #include "content/browser/media/session/media_session_impl.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 MediaSessionServiceImpl::MediaSessionServiceImpl( | 15 MediaSessionServiceImpl::MediaSessionServiceImpl( |
| 16 RenderFrameHost* render_frame_host) | 16 RenderFrameHost* render_frame_host) |
| 17 : render_frame_host_(render_frame_host) {} | 17 : render_frame_host_(render_frame_host) {} |
| 18 | 18 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 39 if (metadata.has_value() && | 39 if (metadata.has_value() && |
| 40 !MediaMetadataSanitizer::CheckSanity(metadata.value())) { | 40 !MediaMetadataSanitizer::CheckSanity(metadata.value())) { |
| 41 render_frame_host_->GetProcess()->ShutdownForBadMessage( | 41 render_frame_host_->GetProcess()->ShutdownForBadMessage( |
| 42 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); | 42 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 WebContentsImpl* contents = static_cast<WebContentsImpl*>( | 46 WebContentsImpl* contents = static_cast<WebContentsImpl*>( |
| 47 WebContentsImpl::FromRenderFrameHost(render_frame_host_)); | 47 WebContentsImpl::FromRenderFrameHost(render_frame_host_)); |
| 48 if (contents) | 48 if (contents) |
| 49 MediaSession::Get(contents)->SetMetadata(metadata); | 49 MediaSessionImpl::Get(contents)->SetMetadata(metadata); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void MediaSessionServiceImpl::EnableAction( | 52 void MediaSessionServiceImpl::EnableAction( |
| 53 blink::mojom::MediaSessionAction action) { | 53 blink::mojom::MediaSessionAction action) { |
| 54 // TODO(zqzhang): Plumb this signal to Java. See https://crbug.com/656563 | 54 // TODO(zqzhang): Plumb this signal to Java. See https://crbug.com/656563 |
| 55 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MediaSessionServiceImpl::DisableAction( | 58 void MediaSessionServiceImpl::DisableAction( |
| 59 blink::mojom::MediaSessionAction action) { | 59 blink::mojom::MediaSessionAction action) { |
| 60 // TODO(zqzhang): Plumb this signal to Java. See https://crbug.com/656563 | 60 // TODO(zqzhang): Plumb this signal to Java. See https://crbug.com/656563 |
| 61 NOTIMPLEMENTED(); | 61 NOTIMPLEMENTED(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void MediaSessionServiceImpl::Bind( | 64 void MediaSessionServiceImpl::Bind( |
| 65 blink::mojom::MediaSessionServiceRequest request) { | 65 blink::mojom::MediaSessionServiceRequest request) { |
| 66 binding_.reset(new mojo::Binding<blink::mojom::MediaSessionService>( | 66 binding_.reset(new mojo::Binding<blink::mojom::MediaSessionService>( |
| 67 this, std::move(request))); | 67 this, std::move(request))); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace content | 70 } // namespace content |
| OLD | NEW |