Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: content/browser/media/android/browser_media_session_manager.cc

Issue 1515623002: Media Session: passing metadata from renderer/ to browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session_ipc
Patch Set: semicolon Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/media/android/browser_media_session_manager.cc
diff --git a/content/browser/media/android/browser_media_session_manager.cc b/content/browser/media/android/browser_media_session_manager.cc
index 146a60fe970ae9da7f0fe9a4b56f044ecdfeec77..a7e5fd5bbfa28e38fdeb8ac7290cacdf3c34f1ec 100644
--- a/content/browser/media/android/browser_media_session_manager.cc
+++ b/content/browser/media/android/browser_media_session_manager.cc
@@ -6,6 +6,8 @@
#include "content/common/media/media_session_messages_android.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/common/media_metadata.h"
namespace content {
@@ -23,6 +25,27 @@ void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) {
Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id));
}
+void BrowserMediaSessionManager::OnSetMetadata(
+ int session_id,
+ const MediaMetadata& insecure_metadata) {
+ // When receiving a MediaMetadata, the browser process can't trust that it is
+ // coming from a known and secure source. It must be processed accordingly.
+ MediaMetadata metadata;
+ metadata.title =
+ insecure_metadata.title.substr(0, MediaMetadata::kMaxIPCStringLength);
+ metadata.artist =
+ insecure_metadata.artist.substr(0, MediaMetadata::kMaxIPCStringLength);
+ metadata.album =
+ insecure_metadata.album.substr(0, MediaMetadata::kMaxIPCStringLength);
+
+ if (metadata != insecure_metadata) {
+ render_frame_host_->GetProcess()->ShutdownForBadMessage();
+ return;
+ }
+
+ NOTIMPLEMENTED();
+}
+
int BrowserMediaSessionManager::GetRoutingID() const {
return render_frame_host_->GetRoutingID();
}

Powered by Google App Engine
This is Rietveld 408576698