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

Side by Side Diff: content/browser/media/android/browser_media_session_manager.cc

Issue 2015433003: Implement MediaMetadata artwork in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits, added TODOs Created 4 years, 6 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/browser/media/session/media_session.h"
8 #include "content/browser/web_contents/web_contents_impl.h"
7 #include "content/common/media/media_session_messages_android.h" 9 #include "content/common/media/media_session_messages_android.h"
8 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
9 #include "content/public/browser/render_process_host.h" 11 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/media_metadata.h" 12 #include "content/public/common/media_metadata.h"
11 13
12 namespace content { 14 namespace content {
13 15
14 BrowserMediaSessionManager::BrowserMediaSessionManager( 16 BrowserMediaSessionManager::BrowserMediaSessionManager(
15 RenderFrameHost* render_frame_host) 17 RenderFrameHost* render_frame_host)
16 : render_frame_host_(render_frame_host) {} 18 : render_frame_host_(render_frame_host) {}
(...skipping 13 matching lines...) Expand all
30 const MediaMetadata& insecure_metadata) { 32 const MediaMetadata& insecure_metadata) {
31 // When receiving a MediaMetadata, the browser process can't trust that it is 33 // 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. 34 // coming from a known and secure source. It must be processed accordingly.
33 MediaMetadata metadata; 35 MediaMetadata metadata;
34 metadata.title = 36 metadata.title =
35 insecure_metadata.title.substr(0, MediaMetadata::kMaxIPCStringLength); 37 insecure_metadata.title.substr(0, MediaMetadata::kMaxIPCStringLength);
36 metadata.artist = 38 metadata.artist =
37 insecure_metadata.artist.substr(0, MediaMetadata::kMaxIPCStringLength); 39 insecure_metadata.artist.substr(0, MediaMetadata::kMaxIPCStringLength);
38 metadata.album = 40 metadata.album =
39 insecure_metadata.album.substr(0, MediaMetadata::kMaxIPCStringLength); 41 insecure_metadata.album.substr(0, MediaMetadata::kMaxIPCStringLength);
42 // TODO(zqzhang): security checking for artwork?
palmer 2016/06/14 22:06:31 What is the nature of the artwork? To what extent
Zhiqiang Zhang (Slow) 2016/06/20 18:26:49 See the other reply for details.
43 metadata.artwork = insecure_metadata.artwork;
40 44
41 if (metadata != insecure_metadata) { 45 if (metadata != insecure_metadata) {
42 render_frame_host_->GetProcess()->ShutdownForBadMessage(); 46 render_frame_host_->GetProcess()->ShutdownForBadMessage();
43 return; 47 return;
44 } 48 }
45 49
46 NOTIMPLEMENTED(); 50 WebContentsImpl* contents = static_cast<WebContentsImpl*>(
51 WebContents::FromRenderFrameHost(render_frame_host_));
52 if (contents)
53 MediaSession::Get(contents)->SetMetadata(metadata);
47 } 54 }
48 55
49 int BrowserMediaSessionManager::GetRoutingID() const { 56 int BrowserMediaSessionManager::GetRoutingID() const {
50 return render_frame_host_->GetRoutingID(); 57 return render_frame_host_->GetRoutingID();
51 } 58 }
52 59
53 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { 60 bool BrowserMediaSessionManager::Send(IPC::Message* msg) {
54 return render_frame_host_->Send(msg); 61 return render_frame_host_->Send(msg);
55 } 62 }
56 63
57 } // namespace content 64 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698