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

Unified Diff: media/remoting/remoting_renderer_controller.cc

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed miu's 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..b35f0c540b7816acadb097e9cf0b2d1f6d7f18e7 100644
--- a/media/remoting/remoting_renderer_controller.cc
+++ b/media/remoting/remoting_renderer_controller.cc
@@ -73,6 +73,15 @@ void RemotingRendererController::OnSetCdm(CdmContext* cdm_context) {
UpdateAndMaybeSwitch();
}
+void RemotingRendererController::OnSetPoster(const GURL& poster_url) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (poster_url != poster_url_) {
+ poster_url_ = poster_url;
+ DownloadPosterImage();
miu 2016/12/22 02:04:02 What if the URL is set to empty (i.e., the web pag
xjz 2016/12/22 20:13:08 This case is really an edge case as the poster ima
xjz 2016/12/22 23:21:12 Done. As chatted face to face, change UpdateInters
+ }
+}
+
void RemotingRendererController::SetSwitchRendererCallback(
const base::Closure& cb) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -243,4 +252,42 @@ void RemotingRendererController::UpdateAndMaybeSwitch() {
}
}
+void RemotingRendererController::SetDownloadPosterCallback(
+ const DownloadPosterCallback& cb) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(download_poster_cb_.is_null());
+ download_poster_cb_ = cb;
+ DownloadPosterImage();
miu 2016/12/22 02:04:02 Along the lines of my previous comment: if (!po
xjz 2016/12/22 23:21:12 Done.
+}
+
+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::DownloadPosterImage() {
+ // TODO(xjz): early return if show interstitial callback is not set.
+ if (download_poster_cb_.is_null() || poster_url_.is_empty())
miu 2016/12/22 02:04:02 nit: Suggest taking out the "|| poster_url_.is_emp
xjz 2016/12/22 23:21:11 Done.
+ return;
+
+ download_poster_cb_.Run(
+ poster_url_,
+ base::Bind(&RemotingRendererController::OnPosterImageDownloaded,
+ weak_factory_.GetWeakPtr(), poster_url_));
+}
+
+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