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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
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/common/media/media_session_messages_android.h" 7 #include "content/common/media/media_session_messages_android.h"
8 #include "content/public/browser/render_frame_host.h" 8 #include "content/public/browser/render_frame_host.h"
9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/media_metadata.h"
9 11
10 namespace content { 12 namespace content {
11 13
12 BrowserMediaSessionManager::BrowserMediaSessionManager( 14 BrowserMediaSessionManager::BrowserMediaSessionManager(
13 RenderFrameHost* render_frame_host) 15 RenderFrameHost* render_frame_host)
14 : render_frame_host_(render_frame_host) {} 16 : render_frame_host_(render_frame_host) {}
15 17
16 void BrowserMediaSessionManager::OnActivate(int session_id, int request_id) { 18 void BrowserMediaSessionManager::OnActivate(int session_id, int request_id) {
17 NOTIMPLEMENTED(); 19 NOTIMPLEMENTED();
18 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false)); 20 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false));
19 } 21 }
20 22
21 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) { 23 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) {
22 NOTIMPLEMENTED(); 24 NOTIMPLEMENTED();
23 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id)); 25 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id));
24 } 26 }
25 27
28 void BrowserMediaSessionManager::OnSetMetadata(
29 int session_id,
30 const MediaMetadata& insecure_metadata) {
31 // 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 MediaMetadata metadata;
34 metadata.title =
35 insecure_metadata.title.substr(0, MediaMetadata::kMaxIPCStringLength);
36 metadata.artist =
37 insecure_metadata.artist.substr(0, MediaMetadata::kMaxIPCStringLength);
38 metadata.album =
39 insecure_metadata.album.substr(0, MediaMetadata::kMaxIPCStringLength);
40
41 if (metadata != insecure_metadata) {
42 render_frame_host_->GetProcess()->ShutdownForBadMessage();
43 return;
44 }
45
46 NOTIMPLEMENTED();
47 }
48
26 int BrowserMediaSessionManager::GetRoutingID() const { 49 int BrowserMediaSessionManager::GetRoutingID() const {
27 return render_frame_host_->GetRoutingID(); 50 return render_frame_host_->GetRoutingID();
28 } 51 }
29 52
30 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { 53 bool BrowserMediaSessionManager::Send(IPC::Message* msg) {
31 return render_frame_host_->Send(msg); 54 return render_frame_host_->Send(msg);
32 } 55 }
33 56
34 } // namespace content 57 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698