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 #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 "base/optional.h" | 7 #include "base/optional.h" |
8 #include "content/browser/media/session/media_session.h" | 8 #include "content/browser/media/session/media_session.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/common/media/media_metadata_sanitizer.h" | 10 #include "content/common/media/media_metadata_sanitizer.h" |
11 #include "content/common/media/media_session_messages_android.h" | |
12 #include "content/public/browser/render_frame_host.h" | 11 #include "content/public/browser/render_frame_host.h" |
13 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/common/media_metadata.h" | 13 #include "content/public/common/media_metadata.h" |
15 | 14 |
16 namespace content { | 15 namespace content { |
17 | 16 |
18 BrowserMediaSessionManager::BrowserMediaSessionManager( | 17 BrowserMediaSessionManager::BrowserMediaSessionManager( |
19 RenderFrameHost* render_frame_host) | 18 RenderFrameHost* render_frame_host) |
20 : render_frame_host_(render_frame_host) {} | 19 : render_frame_host_(render_frame_host) {} |
21 | 20 |
22 void BrowserMediaSessionManager::OnActivate(int session_id, int request_id) { | |
23 NOTIMPLEMENTED(); | |
24 Send(new MediaSessionMsg_DidActivate(GetRoutingID(), request_id, false)); | |
25 } | |
26 | |
27 void BrowserMediaSessionManager::OnDeactivate(int session_id, int request_id) { | |
28 NOTIMPLEMENTED(); | |
29 Send(new MediaSessionMsg_DidDeactivate(GetRoutingID(), request_id)); | |
30 } | |
31 | |
32 void BrowserMediaSessionManager::OnSetMetadata( | 21 void BrowserMediaSessionManager::OnSetMetadata( |
33 int session_id, | 22 int session_id, |
34 const base::Optional<MediaMetadata>& insecure_metadata) { | 23 const base::Optional<MediaMetadata>& insecure_metadata) { |
35 // When receiving a MediaMetadata, the browser process can't trust that it is | 24 // When receiving a MediaMetadata, the browser process can't trust that it is |
36 // coming from a known and secure source. It must be processed accordingly. | 25 // coming from a known and secure source. It must be processed accordingly. |
37 if (insecure_metadata.has_value() && | 26 if (insecure_metadata.has_value() && |
38 !MediaMetadataSanitizer::CheckSanity(insecure_metadata.value())) { | 27 !MediaMetadataSanitizer::CheckSanity(insecure_metadata.value())) { |
39 render_frame_host_->GetProcess()->ShutdownForBadMessage( | 28 render_frame_host_->GetProcess()->ShutdownForBadMessage( |
40 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); | 29 RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); |
41 return; | 30 return; |
42 } | 31 } |
43 | 32 |
44 NOTIMPLEMENTED(); | 33 NOTIMPLEMENTED(); |
45 } | 34 } |
46 | 35 |
47 int BrowserMediaSessionManager::GetRoutingID() const { | |
48 return render_frame_host_->GetRoutingID(); | |
49 } | |
50 | |
51 bool BrowserMediaSessionManager::Send(IPC::Message* msg) { | |
52 return render_frame_host_->Send(msg); | |
53 } | |
54 | |
55 } // namespace content | 36 } // namespace content |
OLD | NEW |