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

Unified Diff: content/browser/media/session/media_session_service_router.h

Issue 2526533002: Allow MediaSession in iframes to be routed (Closed)
Patch Set: Created 4 years, 1 month 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
Index: content/browser/media/session/media_session_service_router.h
diff --git a/content/browser/media/session/media_session_service_router.h b/content/browser/media/session/media_session_service_router.h
new file mode 100644
index 0000000000000000000000000000000000000000..8da312dcdaac4800d4fe36fee3a45bced44cf6f6
--- /dev/null
+++ b/content/browser/media/session/media_session_service_router.h
@@ -0,0 +1,54 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MEDIA_SESSION_SERVICE_ROUTER_H_
+#define CONTENT_BROWSER_MEDIA_SESSION_SERVICE_ROUTER_H_
+
+#include <map>
+
+#include "base/macros.h"
+
+namespace blink {
+namespace mojom {
+enum class MediaSessionAction;
+} // namespace mojom
+} // namespace blink;
+
+namespace content {
+
+class MediaSessionImpl;
+class MediaSessionServiceImpl;
+class RenderFrameHost;
+
+class MediaSessionServiceRouter final {
+ public:
+ MediaSessionServiceRouter(MediaSessionImpl* session);
+ ~MediaSessionServiceRouter();
+
+ void OnServiceCreated(MediaSessionServiceImpl* service);
whywhat 2016/11/22 23:13:16 nit: document public methods and the class.
Zhiqiang Zhang (Slow) 2016/11/25 14:50:41 Done.
+ void OnServiceDestroyed(MediaSessionServiceImpl* service);
+
+ void OnMediaSessionMetadataChanged(MediaSessionServiceImpl* service);
+ void OnMediaSessionActionsChanged(MediaSessionServiceImpl* service);
+
+ void DidReceiveAction(blink::mojom::MediaSessionAction action);
+
+ void MostMeaningfulPlayerObserverMayHaveChanged();
+
+ private:
+ void UpdateRoutedService(MediaSessionServiceImpl* service);
+ bool IsServiceActiveForRenderFrameHost(RenderFrameHost* rfh);
+
+ using ServicesMap = std::map<RenderFrameHost*, MediaSessionServiceImpl*>;
+
+ ServicesMap services_;
+ MediaSessionServiceImpl* routed_service_;
whywhat 2016/11/22 23:13:16 What's the life scope of these pointers? session_
Zhiqiang Zhang (Slow) 2016/11/25 14:50:41 Documented on the ownership.
+ MediaSessionImpl* session_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaSessionServiceRouter);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_SESSION_SERVICE_ROUTER_H_

Powered by Google App Engine
This is Rietveld 408576698