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

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: cleanup Created 5 years 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/common/media_metadata.h"
9 10
10 namespace content { 11 namespace content {
11 12
12 BrowserMediaSessionManager::BrowserMediaSessionManager( 13 BrowserMediaSessionManager::BrowserMediaSessionManager(
13 RenderFrameHost* render_frame_host) 14 RenderFrameHost* render_frame_host)
14 : render_frame_host_(render_frame_host) {} 15 : render_frame_host_(render_frame_host) {}
15 16
16 void BrowserMediaSessionManager::OnActivate(int session_id, int request_id) { 17 void BrowserMediaSessionManager::OnActivate(int session_id, int request_id) {
17 NOTIMPLEMENTED(); 18 NOTIMPLEMENTED();
18 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false)); 19 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false));
19 } 20 }
20 21
21 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) { 22 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) {
22 NOTIMPLEMENTED(); 23 NOTIMPLEMENTED();
23 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id)); 24 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id));
24 } 25 }
25 26
27 void BrowserMediaSessionManager::OnSetMetadata(
28 int session_id,
29 const MediaMetadata& insecure_metadata) {
30 // When receiving a MediaMetadata, the browser process can't trust that it is
31 // coming from a known and secure source. It must be processed accordingly.
32 MediaMetadata metadata = insecure_metadata;
philipj_slow 2015/12/14 14:09:24 Can you initialize it to an empty struct, so that
mlamouri (slow - plz ping) 2016/01/05 16:01:16 Done.
33 metadata.title = base::NullableString16(
34 metadata.title.string().substr(0, MediaMetadata::kMaxIPCStringLength),
35 metadata.title.is_null());
36 metadata.artist = base::NullableString16(
37 metadata.artist.string().substr(0, MediaMetadata::kMaxIPCStringLength),
38 metadata.artist.is_null());
39 metadata.album = base::NullableString16(
40 metadata.album.string().substr(0, MediaMetadata::kMaxIPCStringLength),
41 metadata.album.is_null());
42
jochen (gone - plz use gerrit) 2015/12/14 12:38:30 kill the renderer if insecure_metadata != metadata
mlamouri (slow - plz ping) 2016/01/05 16:01:16 Done.
43 NOTIMPLEMENTED();
44 }
45
26 int BrowserMediaSessionManager::GetRoutingID() const { 46 int BrowserMediaSessionManager::GetRoutingID() const {
27 return render_frame_host_->GetRoutingID(); 47 return render_frame_host_->GetRoutingID();
28 } 48 }
29 49
30 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { 50 bool BrowserMediaSessionManager::Send(IPC::Message* msg) {
31 return render_frame_host_->Send(msg); 51 return render_frame_host_->Send(msg);
32 } 52 }
33 53
34 } // namespace content 54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698