Chromium Code Reviews| 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/android/browser_media_session_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/media/session/media_session.h" | 7 #include "content/browser/media/session/media_session.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/common/media/media_metadata_sanitizer.h" | 9 #include "content/common/media/media_metadata_sanitizer.h" |
| 10 #include "content/common/media/media_session_messages_android.h" | 10 #include "content/common/media/media_session_messages_android.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false)); | 23 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) { | 26 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) { |
| 27 NOTIMPLEMENTED(); | 27 NOTIMPLEMENTED(); |
| 28 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id)); | 28 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void BrowserMediaSessionManager::OnSetMetadata( | 31 void BrowserMediaSessionManager::OnSetMetadata( |
| 32 int session_id, | 32 int session_id, |
| 33 const MediaMetadata& insecure_metadata) { | 33 const base::Optional<MediaMetadata>& insecure_metadata) { |
| 34 // When receiving a MediaMetadata, the browser process can't trust that it is | 34 // When receiving a MediaMetadata, the browser process can't trust that it is |
| 35 // coming from a known and secure source. It must be processed accordingly. | 35 // coming from a known and secure source. It must be processed accordingly. |
| 36 if (!MediaMetadataSanitizer::CheckSanity(insecure_metadata)) { | 36 if (insecure_metadata && |
|
mlamouri (slow - plz ping)
2016/09/01 17:47:49
Maybe `insecure_metadata.has_value()`
Zhiqiang Zhang (Slow)
2016/09/02 12:11:41
Done.
| |
| 37 !MediaMetadataSanitizer::CheckSanity(insecure_metadata.value())) { | |
| 37 render_frame_host_->GetProcess()->ShutdownForBadMessage(); | 38 render_frame_host_->GetProcess()->ShutdownForBadMessage(); |
| 38 return; | 39 return; |
| 39 } | 40 } |
| 40 | 41 |
| 41 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
| 42 } | 43 } |
| 43 | 44 |
| 44 int BrowserMediaSessionManager::GetRoutingID() const { | 45 int BrowserMediaSessionManager::GetRoutingID() const { |
| 45 return render_frame_host_->GetRoutingID(); | 46 return render_frame_host_->GetRoutingID(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { | 49 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { |
| 49 return render_frame_host_->Send(msg); | 50 return render_frame_host_->Send(msg); |
| 50 } | 51 } |
| 51 | 52 |
| 52 } // namespace content | 53 } // namespace content |
| OLD | NEW |