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

Unified Diff: media/remoting/remoting_renderer_controller.h

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed xhwang's comment. 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
Index: media/remoting/remoting_renderer_controller.h
diff --git a/media/remoting/remoting_renderer_controller.h b/media/remoting/remoting_renderer_controller.h
index 9c98af12b555441c1ade86ff34291b321c7a8076..bf235f3266df84006602d3107aabc900fec407b3 100644
--- a/media/remoting/remoting_renderer_controller.h
+++ b/media/remoting/remoting_renderer_controller.h
@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h"
#include "media/base/media_observer.h"
#include "media/remoting/remoting_source_impl.h"
+#include "third_party/skia/include/core/SkBitmap.h"
namespace media {
@@ -37,9 +38,27 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
void OnExitedFullscreen() override;
void OnSetCdm(CdmContext* cdm_context) override;
void OnMetadataChanged(const PipelineMetadata& metadata) override;
+ void OnSetPoster(const GURL& poster) override;
void SetSwitchRendererCallback(const base::Closure& cb);
+ using DownloadPosterCallback =
+ base::Callback<void(const GURL&,
+ const base::Callback<void(const SkBitmap&)>&)>;
+ // Set the callback to download poster image. Can only be called once.
+ void SetDownloadPosterCallback(const DownloadPosterCallback& cb);
+
+ // Download the poster image if available, and show remoting interstitial.
+ // Called when the poster URL is changed (to update the background image).
+ // TODO(xjz): https://codereview.chromium.org/2566223005/
+ // Call this when:
+ // 1. SetShowInterstitialCallback() is called (RemoteRendererImpl is created).
+ // 2. The remoting session is shut down (to update the status message in the
+ // interstitial).
+ // 3. The size of the canvas is changed (to update the background image and
+ // the position of the status message).
+ void UpdateAndMaybeShowInterstitial();
+
base::WeakPtr<RemotingRendererController> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
@@ -90,6 +109,9 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
// necessary.
void UpdateAndMaybeSwitch();
+ // Called when poster image is downloaded.
+ void PosterImageDownloaded(const SkBitmap& image);
+
// Indicates whether this media element or its ancestor is in full screen.
bool is_fullscreen_ = false;
@@ -116,6 +138,10 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
PipelineMetadata pipeline_metadata_;
+ GURL poster_url_;
miu 2016/12/20 00:48:07 nit: Needs comment ("Current poster URL, whose ima
xjz 2016/12/20 21:46:25 Done.
+
+ DownloadPosterCallback download_poster_cb_;
miu 2016/12/20 00:48:06 ditto: Short comment, please.
xjz 2016/12/20 21:46:25 Done.
+
base::WeakPtrFactory<RemotingRendererController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RemotingRendererController);

Powered by Google App Engine
This is Rietveld 408576698