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

Unified Diff: content/browser/media/session/media_session_service_impl.cc

Issue 2399023002: Make MediaSession available on Desktop (Closed)
Patch Set: merge BrowserMediaSessionManager into MediaSessionServiceImpl, temporarily removing BrowserTests Created 4 years, 2 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
« no previous file with comments | « content/browser/media/session/media_session_service_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/session/media_session_service_impl.cc
diff --git a/content/browser/media/android/media_session_service_impl.cc b/content/browser/media/session/media_session_service_impl.cc
similarity index 65%
rename from content/browser/media/android/media_session_service_impl.cc
rename to content/browser/media/session/media_session_service_impl.cc
index 51e2799590d2dfa78491e04fa626e784df1ab7ba..c4dd89961cabaef82ffcb6e54acf274111529067 100644
--- a/content/browser/media/android/media_session_service_impl.cc
+++ b/content/browser/media/session/media_session_service_impl.cc
@@ -2,15 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/media/android/media_session_service_impl.h"
+#include "content/browser/media/session/media_session_service_impl.h"
-#include "base/strings/utf_string_conversions.h"
-#include "content/browser/media/android/browser_media_session_manager.h"
-#include "content/browser/media/android/media_web_contents_observer_android.h"
+#include "content/browser/media/session/media_metadata_sanitizer.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/media_metadata.h"
namespace content {
@@ -31,12 +28,18 @@ void MediaSessionServiceImpl::Create(
void MediaSessionServiceImpl::SetMetadata(
const base::Optional<content::MediaMetadata>& metadata) {
- WebContentsImpl* contents = static_cast<WebContentsImpl*>(
- WebContents::FromRenderFrameHost(render_frame_host_));
- DCHECK(contents);
- MediaWebContentsObserverAndroid::FromWebContents(contents)
- ->GetMediaSessionManager(render_frame_host_)
- ->OnSetMetadata(0, 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.
+ if (metadata.has_value() &&
+ !MediaMetadataSanitizer::CheckSanity(metadata.value())) {
+ render_frame_host_->GetProcess()->ShutdownForBadMessage(
+ RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP);
+ return;
+ }
+
+ metadata_ = metadata;
+
+ NOTIMPLEMENTED();
sandersd (OOO until July 31) 2016/10/07 22:33:48 ?
Zhiqiang Zhang (Slow) 2016/10/07 22:37:03 Yes, this `NOTIMPLEMENTED` was from BrowserMediaSe
}
void MediaSessionServiceImpl::Bind(
« no previous file with comments | « content/browser/media/session/media_session_service_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698