Chromium Code Reviews| 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_ |