| 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/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 | 14 |
| 14 MediaSessionServiceImpl::MediaSessionServiceImpl( | 15 MediaSessionServiceImpl::MediaSessionServiceImpl( |
| 15 RenderFrameHost* render_frame_host) | 16 RenderFrameHost* render_frame_host) |
| 16 : render_frame_host_(render_frame_host) {} | 17 : render_frame_host_(render_frame_host) {} |
| 17 | 18 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 const base::Optional<content::MediaMetadata>& metadata) { | 31 const base::Optional<content::MediaMetadata>& metadata) { |
| 31 // When receiving a MediaMetadata, the browser process can't trust that it is | 32 // When receiving a MediaMetadata, the browser process can't trust that it is |
| 32 // coming from a known and secure source. It must be processed accordingly. | 33 // coming from a known and secure source. It must be processed accordingly. |
| 33 if (metadata.has_value() && | 34 if (metadata.has_value() && |
| 34 !MediaMetadataSanitizer::CheckSanity(metadata.value())) { | 35 !MediaMetadataSanitizer::CheckSanity(metadata.value())) { |
| 35 render_frame_host_->GetProcess()->ShutdownForBadMessage( | 36 render_frame_host_->GetProcess()->ShutdownForBadMessage( |
| 36 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); | 37 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); |
| 37 return; | 38 return; |
| 38 } | 39 } |
| 39 | 40 |
| 40 metadata_ = metadata; | 41 WebContentsImpl* contents = static_cast<WebContentsImpl*>( |
| 41 | 42 WebContentsImpl::FromRenderFrameHost(render_frame_host_)); |
| 42 NOTIMPLEMENTED(); | 43 if (contents) |
| 44 MediaSession::Get(contents)->SetMetadata(metadata); |
| 43 } | 45 } |
| 44 | 46 |
| 45 void MediaSessionServiceImpl::Bind( | 47 void MediaSessionServiceImpl::Bind( |
| 46 blink::mojom::MediaSessionServiceRequest request) { | 48 blink::mojom::MediaSessionServiceRequest request) { |
| 47 binding_.reset(new mojo::Binding<blink::mojom::MediaSessionService>( | 49 binding_.reset(new mojo::Binding<blink::mojom::MediaSessionService>( |
| 48 this, std::move(request))); | 50 this, std::move(request))); |
| 49 } | 51 } |
| 50 | 52 |
| 51 } // namespace content | 53 } // namespace content |
| OLD | NEW |