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

Unified Diff: media/remoting/remoting_renderer_controller.h

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
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..35ca9e64dcae16f74d4dc22abeb6e238af6fe46b 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,16 @@ 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);
+
base::WeakPtr<RemotingRendererController> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
@@ -90,7 +98,29 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
// necessary.
void UpdateAndMaybeSwitch();
- // Indicates whether this media element or its ancestor is in full screen.
+ // Called to download the poster image. Called when:
+ // 1. Poster URL changes.
+ // 2. ShowInterstitialCallback is set.
+ // 3. DownloadPosterCallback is set.
+ void DownloadPosterImage();
+
+ // Called when poster image is downloaded.
+ void OnPosterImageDownloaded(const GURL& download_url, const SkBitmap& image);
+
+ // Update remoting interstitial with |image|. When |image| is empty,
+ // interstitial will be drawn on previously downloaded poster image (in
+ // RemoteRendererImpl) or black background if none was downloaded before.
+ // 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).
+ // 4. Poster image is downloaded (to update the background image).
+ void UpdateInterstitial(const SkBitmap& image);
+
+ // Indicates whether this media element is in full screen.
bool is_fullscreen_ = false;
// Indicates whether remoting is started.
@@ -114,8 +144,17 @@ class RemotingRendererController final : public RemotingSourceImpl::Client,
// debug builds.
base::ThreadChecker thread_checker_;
+ // Current pipeline metadata.
PipelineMetadata pipeline_metadata_;
+ // Current poster URL, whose image will feed into the local UI.
+ GURL poster_url_;
+
+ // The callback to download the poster image. Called when |poster_url_|
+ // changes during a remoting session or the show interstial callback is set.
+ // OnPosterImageDownloaded() will be called when download completes.
+ DownloadPosterCallback download_poster_cb_;
+
base::WeakPtrFactory<RemotingRendererController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(RemotingRendererController);

Powered by Google App Engine
This is Rietveld 408576698