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

Unified Diff: content/browser/media/media_web_contents_observer.h

Issue 1580493004: Plumb audio focus support for spitzer clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate_hookup
Patch Set: Rebase. Created 4 years, 11 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
Index: content/browser/media/media_web_contents_observer.h
diff --git a/content/browser/media/media_web_contents_observer.h b/content/browser/media/media_web_contents_observer.h
index d902dc9608d40b80ac856590de24396884c16d09..6dcbfc186909c8f8ada54279e2d209d0792a9d14 100644
--- a/content/browser/media/media_web_contents_observer.h
+++ b/content/browser/media/media_web_contents_observer.h
@@ -11,6 +11,7 @@
#include <set>
#include <vector>
+#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
@@ -47,6 +48,26 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver {
return !!video_power_save_blocker_;
}
+ // Executes |focus_cb| on the calling thread once the given render frame has
+ // audio focus. Clients are responsible for invalidating |focus_cb| if their
+ // lifetime changes or the callback is unnecessary.
+ //
+ // This call does not request focus, it only waits for a focus request for the
+ // given render frame to be approved. The focus request must be initiated via
+ // the WebMediaPlayerDelegate interface in the renderer.
+ //
+ // Focus is never denied, only delayed until the underlying platform approves
+ // the request. |focus_cb| may never be called if the given render frame goes
+ // away. Callers are expected to have their own monitoring for such events in
+ // order to properly handle the lack of a callback.
+ static void WaitForAudioFocusAsync(int render_process_id,
+ int render_frame_id,
+ const base::Closure& focus_cb);
+
+ protected:
+ virtual void WaitForAudioFocusAsyncInternal(int render_frame_id,
+ const base::Closure& focus_cb);
+
private:
void OnMediaDestroyed(RenderFrameHost* render_frame_host, int delegate_id);
void OnMediaPaused(RenderFrameHost* render_frame_host,

Powered by Google App Engine
This is Rietveld 408576698