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

Unified Diff: chromecast/browser/cast_media_blocker.h

Issue 2450433002: Let CastMediaBlocker observe MediaSession instead of WebContents (Closed)
Patch Set: addressed comments Created 4 years, 2 months 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 | « no previous file | chromecast/browser/cast_media_blocker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_media_blocker.h
diff --git a/chromecast/browser/cast_media_blocker.h b/chromecast/browser/cast_media_blocker.h
index b3350603f7b1fb448130768b7a7eb26cca37b899..d44ec6e04e96bb78aeea2af1be04e3b8a155dbe8 100644
--- a/chromecast/browser/cast_media_blocker.h
+++ b/chromecast/browser/cast_media_blocker.h
@@ -6,35 +6,29 @@
#define CHROMECAST_BROWSER_CAST_MEDIA_BLOCKER_H_
#include "base/macros.h"
-#include "base/callback_forward.h"
+#include "content/public/browser/media_session_observer.h"
#include "content/public/browser/web_contents_observer.h"
-namespace content {
-class WebContents;
-} // namespace content
-
namespace chromecast {
namespace shell {
// This class implements a blocking mode for web applications and is used in
// Chromecast internal code. Media is unblocked by default.
-class CastMediaBlocker : public content::WebContentsObserver {
+//
+// TODO(derekjchow): Remove the inheritance from WebContentsObserver.
+// See http://crbug.com/660331
+class CastMediaBlocker : public content::MediaSessionObserver,
+ content::WebContentsObserver {
halliwell 2016/10/28 17:33:29 This inheritance seems pointless now. Derek, are
derekjchow1 2016/10/28 17:35:41 Yes, I requested this so I could synchronize chang
public:
- explicit CastMediaBlocker(content::WebContents* web_contents);
-
- // Constructor for test. |suspend_cb| and |resume_cb| will be called when
- // Suspend() and Resume() are called.
- CastMediaBlocker(content::WebContents* web_contents,
- const base::Closure& suspend_cb,
- const base::Closure& resume_cb);
-
+ explicit CastMediaBlocker(content::MediaSession* media_session,
+ content::WebContents* web_contents);
halliwell 2016/10/28 17:33:29 nit: remove explicit
~CastMediaBlocker() override;
// Sets if the web contents is allowed to play media or not. If media is
// unblocked, previously suspended elements should begin playing again.
void BlockMediaLoading(bool blocked);
- // content::WebContentsObserver implementation:
+ // content::MediaSessionObserver implementation:
void MediaSessionStateChanged(bool is_controllable,
bool is_suspended) override;
@@ -50,9 +44,6 @@ class CastMediaBlocker : public content::WebContentsObserver {
void Suspend();
void Resume();
- base::Closure suspend_cb_;
- base::Closure resume_cb_;
-
// Whether or not media should be blocked. This value cache's the last call to
// BlockMediaLoading. Is false by default.
bool blocked_;
« no previous file with comments | « no previous file | chromecast/browser/cast_media_blocker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698