OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/media/android/browser_surface_view_manager.h" | |
6 | |
7 #include "content/browser/android/child_process_launcher_android.h" | |
8 #include "content/browser/android/content_view_core_impl.h" | |
9 #include "content/browser/gpu/gpu_surface_tracker.h" | |
10 #include "content/browser/web_contents/web_contents_impl.h" | |
11 #include "content/common/media/surface_view_manager_messages_android.h" | |
12 #include "content/public/browser/render_frame_host.h" | |
13 | |
14 namespace content { | |
15 | |
16 BrowserSurfaceViewManager::BrowserSurfaceViewManager( | |
17 RenderFrameHost* render_frame_host) | |
18 : render_frame_host_(render_frame_host) {} | |
19 | |
20 void BrowserSurfaceViewManager::SetVideoSurface( | |
21 gfx::ScopedJavaSurface surface) { | |
22 if (surface.IsEmpty()) { | |
23 GpuSurfaceTracker::Get()->RemoveSurface(surface_view_id_); | |
24 UnregisterViewSurface(surface_view_id_); | |
25 } else { | |
26 // We mainly use the surface tracker to allocate a surface id for us. The | |
27 // lookup will go through the Android specific path and get the java | |
28 // surface directly, so there's no need to add a valid native widget here. | |
29 surface_view_id_ = GpuSurfaceTracker::Get()->AddSurfaceForNativeWidget( | |
30 gfx::kNullAcceleratedWidget); | |
31 RegisterViewSurface(surface_view_id_, surface.j_surface().obj()); | |
32 Send(new RendererSurfaceViewManagerMsg_FullscreenSurfaceCreated( | |
33 render_frame_host_->GetRoutingID(), surface_view_id_)); | |
34 } | |
35 } | |
36 | |
37 void BrowserSurfaceViewManager::DidExitFullscreen(bool release_media_player) { | |
38 content_video_view_.reset(); | |
39 } | |
40 | |
41 void BrowserSurfaceViewManager::OnCreateFullscreenSurface() { | |
42 DCHECK(!ContentVideoView::GetInstance()); | |
43 ContentViewCore* cvc = ContentViewCore::FromWebContents( | |
44 WebContents::FromRenderFrameHost(render_frame_host_)); | |
45 content_video_view_.reset(new ContentVideoView(this, cvc)); | |
46 base::android::ScopedJavaLocalRef<jobject> j_content_video_view = | |
47 content_video_view_->GetJavaObject(base::android::AttachCurrentThread()); | |
48 if (!j_content_video_view.is_null()) { | |
49 // XXX: plumb through the size change event. | |
DaleCurtis
2016/02/02 01:01:32
Do you have a vision for what this looks like? Ano
watk
2016/02/02 20:38:14
Yeah, that's what I was thinking, but haven't figu
watk
2016/02/05 03:42:30
This turned out to be pretty simple. I just pass t
| |
50 content_video_view_->OnVideoSizeChanged(1280, 720); | |
51 } | |
52 } | |
53 | |
54 bool BrowserSurfaceViewManager::Send(IPC::Message* msg) { | |
55 return render_frame_host_->Send(msg); | |
56 } | |
57 | |
58 } // namespace content | |
OLD | NEW |