| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/common/media_metadata.h" |
| 11 | 12 |
| 12 namespace IPC { | 13 namespace IPC { |
| 13 class Message; | 14 class Message; |
| 14 } // namespace IPC | 15 } // namespace IPC |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class RenderFrameHost; | 19 class RenderFrameHost; |
| 19 struct MediaMetadata; | 20 class WebContentsImpl; |
| 20 | 21 |
| 21 class CONTENT_EXPORT BrowserMediaSessionManager { | 22 class CONTENT_EXPORT BrowserMediaSessionManager { |
| 22 public: | 23 public: |
| 23 explicit BrowserMediaSessionManager(RenderFrameHost* render_frame_host); | 24 explicit BrowserMediaSessionManager(RenderFrameHost* render_frame_host, |
| 25 WebContentsImpl* contents); |
| 26 virtual ~BrowserMediaSessionManager(); |
| 24 | 27 |
| 25 // Message handlers. | 28 // Message handlers. |
| 26 virtual void OnActivate(int session_id, int request_id); | 29 virtual void OnActivate(int session_id, int request_id); |
| 27 virtual void OnDeactivate(int session_id, int request_id); | 30 virtual void OnDeactivate(int session_id, int request_id); |
| 31 // Handler for SetMetadata message. |
| 32 // Since the message comes from IPC, |insecure_metadata| might be insecure |
| 33 // since it might come from an attacker. The callback should check the its |
| 34 // sanity before any further actions. |
| 28 virtual void OnSetMetadata( | 35 virtual void OnSetMetadata( |
| 29 int session_id, const base::Optional<MediaMetadata>& metadata); | 36 int session_id, const base::Optional<MediaMetadata>& insecure_metadata); |
| 37 |
| 38 const base::Optional<MediaMetadata>& media_metadata() const { |
| 39 return media_metadata_; |
| 40 } |
| 30 | 41 |
| 31 int GetRoutingID() const; | 42 int GetRoutingID() const; |
| 32 | 43 |
| 33 bool Send(IPC::Message* msg); | 44 bool Send(IPC::Message* msg); |
| 34 | 45 |
| 35 private: | 46 private: |
| 36 RenderFrameHost* const render_frame_host_; | 47 RenderFrameHost* const render_frame_host_; |
| 48 WebContentsImpl* const contents_; |
| 49 |
| 50 base::Optional<MediaMetadata> media_metadata_; |
| 37 | 51 |
| 38 DISALLOW_COPY_AND_ASSIGN(BrowserMediaSessionManager); | 52 DISALLOW_COPY_AND_ASSIGN(BrowserMediaSessionManager); |
| 39 }; | 53 }; |
| 40 | 54 |
| 41 } // namespace content | 55 } // namespace content |
| 42 | 56 |
| 43 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ | 57 #endif // CONTENT_BROWSER_MEDIA_ANDROID_BROWSER_MEDIA_SESSION_MANAGER_H_ |
| OLD | NEW |