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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #include "media/renderers/default_renderer_factory.h" 255 #include "media/renderers/default_renderer_factory.h"
256 #endif 256 #endif
257 257
258 #if defined(ENABLE_MOJO_AUDIO_DECODER) || defined(ENABLE_MOJO_VIDEO_DECODER) 258 #if defined(ENABLE_MOJO_AUDIO_DECODER) || defined(ENABLE_MOJO_VIDEO_DECODER)
259 #include "media/mojo/clients/mojo_decoder_factory.h" // nogncheck 259 #include "media/mojo/clients/mojo_decoder_factory.h" // nogncheck
260 #endif 260 #endif
261 261
262 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) 262 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
263 #include "media/remoting/remoting_cdm_controller.h" // nogncheck 263 #include "media/remoting/remoting_cdm_controller.h" // nogncheck
264 #include "media/remoting/remoting_cdm_factory.h" // nogncheck 264 #include "media/remoting/remoting_cdm_factory.h" // nogncheck
265 #include "media/remoting/remoting_renderer_controller.h" // nogncheck
266 #include "media/remoting/remoting_renderer_factory.h" // nogncheck 265 #include "media/remoting/remoting_renderer_factory.h" // nogncheck
267 #include "media/remoting/remoting_sink_observer.h" // nogncheck 266 #include "media/remoting/remoting_sink_observer.h" // nogncheck
268 #endif 267 #endif
269 268
270 using base::Time; 269 using base::Time;
271 using base::TimeDelta; 270 using base::TimeDelta;
272 using blink::WebCachePolicy; 271 using blink::WebCachePolicy;
273 using blink::WebContentDecryptionModule; 272 using blink::WebContentDecryptionModule;
274 using blink::WebContextMenuData; 273 using blink::WebContextMenuData;
275 using blink::WebCString; 274 using blink::WebCString;
(...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 2897
2899 #if defined(OS_ANDROID) // WMPI_CAST 2898 #if defined(OS_ANDROID) // WMPI_CAST
2900 media_player->SetMediaPlayerManager(GetMediaPlayerManager()); 2899 media_player->SetMediaPlayerManager(GetMediaPlayerManager());
2901 media_player->SetDeviceScaleFactor(render_view_->GetDeviceScaleFactor()); 2900 media_player->SetDeviceScaleFactor(render_view_->GetDeviceScaleFactor());
2902 media_player->SetUseFallbackPath(use_fallback_path); 2901 media_player->SetUseFallbackPath(use_fallback_path);
2903 #endif // defined(OS_ANDROID) 2902 #endif // defined(OS_ANDROID)
2904 2903
2905 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) 2904 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
2906 remoting_controller_ptr->SetSwitchRendererCallback(base::Bind( 2905 remoting_controller_ptr->SetSwitchRendererCallback(base::Bind(
2907 &media::WebMediaPlayerImpl::ScheduleRestart, media_player->AsWeakPtr())); 2906 &media::WebMediaPlayerImpl::ScheduleRestart, media_player->AsWeakPtr()));
2907 remoting_controller_ptr->SetDownloadPosterCallback(
2908 base::Bind(&RenderFrameImpl::DownloadPoster, weak_factory_.GetWeakPtr()));
2908 #endif 2909 #endif
2909 return media_player; 2910 return media_player;
2910 } 2911 }
2911 2912
2912 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost( 2913 blink::WebApplicationCacheHost* RenderFrameImpl::createApplicationCacheHost(
2913 blink::WebApplicationCacheHostClient* client) { 2914 blink::WebApplicationCacheHostClient* client) {
2914 if (!frame_ || !frame_->view()) 2915 if (!frame_ || !frame_->view())
2915 return NULL; 2916 return NULL;
2916 return new RendererWebApplicationCacheHostImpl( 2917 return new RendererWebApplicationCacheHostImpl(
2917 RenderViewImpl::FromWebView(frame_->view()), client, 2918 RenderViewImpl::FromWebView(frame_->view()), client,
(...skipping 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after
6659 // And then the mouse event is forwarded to blink, which dispatches it to the 6660 // And then the mouse event is forwarded to blink, which dispatches it to the
6660 // event target. Potentially a Pepper plugin will receive the event. 6661 // event target. Potentially a Pepper plugin will receive the event.
6661 // In order to tell whether a plugin gets the last mouse event and which it 6662 // In order to tell whether a plugin gets the last mouse event and which it
6662 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6663 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6663 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6664 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6664 // |pepper_last_mouse_event_target_|. 6665 // |pepper_last_mouse_event_target_|.
6665 pepper_last_mouse_event_target_ = nullptr; 6666 pepper_last_mouse_event_target_ = nullptr;
6666 #endif 6667 #endif
6667 } 6668 }
6668 6669
6670 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
6671 void RenderFrameImpl::DownloadPoster(
6672 const GURL& url,
6673 const media::RemotingRendererController::PosterDownloadedCallback& cb) {
6674 if (cb.is_null())
6675 return;
6676
6677 if (!poster_image_downloader_)
6678 poster_image_downloader_.reset(new ImageDownloaderImpl(this));
6679 poster_image_downloader_->DownloadImage(
6680 url, false, 1920 * 1920, false,
miu 2016/11/29 22:56:08 1920*1920 seems arbitrary, and some poster images
xjz 2016/12/02 19:23:10 Not applicable.
6681 base::Bind(&RenderFrameImpl::PosterDownloaded, weak_factory_.GetWeakPtr(),
6682 cb));
6683 }
6684
6685 void RenderFrameImpl::PosterDownloaded(
6686 const media::RemotingRendererController::PosterDownloadedCallback& cb,
6687 int32_t http_status_code,
6688 const std::vector<SkBitmap>& images,
6689 const std::vector<gfx::Size>& sizes) {
6690 DCHECK(!cb.is_null());
6691 cb.Run(images[0]);
6692 }
6693 #endif
6694
6669 } // namespace content 6695 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698