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

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: addressed Mounir's comments 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 for (const auto& artwork : insecure_metadata.artwork) {
43 auto sanitized_artwork =
44 MediaMetadata::SanitizeArtwork(artwork);
45 if (sanitized_artwork)
46 metadata.artwork.push_back(sanitized_artwork.value());
47 }
40 48
41 if (metadata != insecure_metadata) { 49 if (metadata != insecure_metadata) {
42 render_frame_host_->GetProcess()->ShutdownForBadMessage(); 50 render_frame_host_->GetProcess()->ShutdownForBadMessage();
43 return; 51 return;
44 } 52 }
45 53
46 NOTIMPLEMENTED(); 54 NOTIMPLEMENTED();
47 } 55 }
48 56
49 int BrowserMediaSessionManager::GetRoutingID() const { 57 int BrowserMediaSessionManager::GetRoutingID() const {
50 return render_frame_host_->GetRoutingID(); 58 return render_frame_host_->GetRoutingID();
51 } 59 }
52 60
53 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { 61 bool BrowserMediaSessionManager::Send(IPC::Message* msg) {
54 return render_frame_host_->Send(msg); 62 return render_frame_host_->Send(msg);
55 } 63 }
56 64
57 } // namespace content 65 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698