| 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/browser/media/android/browser_media_session_manager.h" | 5 #include "content/browser/media/session/browser_media_session_manager.h" |
| 6 | 6 |
| 7 #include "base/optional.h" | 7 #include "base/optional.h" |
| 8 #include "content/browser/media/session/media_metadata_sanitizer.h" |
| 8 #include "content/browser/media/session/media_session.h" | 9 #include "content/browser/media/session/media_session.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/common/media/media_metadata_sanitizer.h" | |
| 11 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
| 12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 13 #include "content/public/common/media_metadata.h" | 13 #include "content/public/common/media_metadata.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 BrowserMediaSessionManager::BrowserMediaSessionManager( | 17 BrowserMediaSessionManager::BrowserMediaSessionManager( |
| 18 RenderFrameHost* render_frame_host) | 18 RenderFrameHost* render_frame_host) |
| 19 : render_frame_host_(render_frame_host) {} | 19 : render_frame_host_(render_frame_host) {} |
| 20 | 20 |
| 21 void BrowserMediaSessionManager::OnSetMetadata( | 21 void BrowserMediaSessionManager::OnSetMetadata( |
| 22 int session_id, | 22 int session_id, |
| 23 const base::Optional<MediaMetadata>& insecure_metadata) { | 23 const base::Optional<MediaMetadata>& insecure_metadata) { |
| 24 // When receiving a MediaMetadata, the browser process can't trust that it is | 24 // When receiving a MediaMetadata, the browser process can't trust that it is |
| 25 // coming from a known and secure source. It must be processed accordingly. | 25 // coming from a known and secure source. It must be processed accordingly. |
| 26 if (insecure_metadata.has_value() && | 26 if (insecure_metadata.has_value() && |
| 27 !MediaMetadataSanitizer::CheckSanity(insecure_metadata.value())) { | 27 !MediaMetadataSanitizer::CheckSanity(insecure_metadata.value())) { |
| 28 render_frame_host_->GetProcess()->ShutdownForBadMessage( | 28 render_frame_host_->GetProcess()->ShutdownForBadMessage( |
| 29 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); | 29 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 | 32 |
| 33 NOTIMPLEMENTED(); | 33 NOTIMPLEMENTED(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace content | 36 } // namespace content |
| OLD | NEW |