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

Unified Diff: media/remoting/remoting_renderer_controller.cc

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/remoting/remoting_renderer_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/remoting/remoting_renderer_controller.cc
diff --git a/media/remoting/remoting_renderer_controller.cc b/media/remoting/remoting_renderer_controller.cc
index 5f0d37eacdbc7a5939d49d5b0941e7077d07da8f..503005d2880a4c726959e97c6f65ca45fefb55f8 100644
--- a/media/remoting/remoting_renderer_controller.cc
+++ b/media/remoting/remoting_renderer_controller.cc
@@ -73,6 +73,26 @@ void RemotingRendererController::OnSetCdm(CdmContext* cdm_context) {
UpdateAndMaybeSwitch();
}
+void RemotingRendererController::OnSetPoster(const GURL& poster_url) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ const GURL old_url = poster_url_;
+ poster_url_ = poster_url;
+
+ // TODO(xjz): Only download the image when we need to draw/update remoting
miu 2016/12/20 23:34:22 I'm not sure this is what we would want. It could
xjz 2016/12/21 01:28:40 hmm, I think we don't want to download and keep a
+ // interstitial. Early return if the show interstitial callback is not set.
+ // https://codereview.chromium.org/2566223005/.
+ if (download_poster_cb_.is_null())
+ return;
+
+ if (old_url != poster_url_) {
+ download_poster_cb_.Run(
+ poster_url_,
+ base::Bind(&RemotingRendererController::OnPosterImageDownloaded,
+ weak_factory_.GetWeakPtr(), poster_url_));
+ }
+}
+
void RemotingRendererController::SetSwitchRendererCallback(
const base::Closure& cb) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -243,4 +263,30 @@ void RemotingRendererController::UpdateAndMaybeSwitch() {
}
}
+void RemotingRendererController::SetDownloadPosterCallback(
+ const DownloadPosterCallback& cb) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(download_poster_cb_.is_null());
+ download_poster_cb_ = cb;
miu 2016/12/20 23:34:22 This just occurred to me: What if the poster URL i
xjz 2016/12/21 01:28:40 Done. I didn't realize this. Thanks for pointing t
+}
+
+void RemotingRendererController::UpdateInterstitial(const SkBitmap& image) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (pipeline_metadata_.natural_size.IsEmpty() || !remote_rendering_started_)
+ return;
+
+ // TODO(xjz): Update interstitial.
+ // https://codereview.chromium.org/2566223005/
+}
+
+void RemotingRendererController::OnPosterImageDownloaded(
+ const GURL& download_url,
+ const SkBitmap& image) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (download_url != poster_url_)
+ return; // The poster image URL has changed during the download.
+ UpdateInterstitial(image);
+}
+
} // namespace media
« no previous file with comments | « media/remoting/remoting_renderer_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698