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

Unified Diff: content/browser/renderer_host/media/media_stream_ui_proxy.h

Issue 2869733005: Convert some audio code to OnceCallback. (Closed)
Patch Set: Rebase, comments on unretained. Created 3 years, 7 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/renderer_host/media/media_stream_ui_proxy.h
diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.h b/content/browser/renderer_host/media/media_stream_ui_proxy.h
index 8f9a9f6453056c2545764be68ea58b57305aad55..7f8b121e5bef27a456f57081d034f39236be92da 100644
--- a/content/browser/renderer_host/media/media_stream_ui_proxy.h
+++ b/content/browser/renderer_host/media/media_stream_ui_proxy.h
@@ -22,12 +22,12 @@ class RenderFrameHostDelegate;
// be created, used and destroyed on IO thread.
class CONTENT_EXPORT MediaStreamUIProxy {
public:
- typedef base::Callback<
- void(const MediaStreamDevices& devices,
- content::MediaStreamRequestResult result)>
- ResponseCallback;
+ using ResponseCallback =
+ base::OnceCallback<void(const MediaStreamDevices& devices,
+ content::MediaStreamRequestResult result)>;
- typedef base::Callback<void(gfx::NativeViewId window_id)> WindowIdCallback;
+ using WindowIdCallback =
+ base::OnceCallback<void(gfx::NativeViewId window_id)>;
static std::unique_ptr<MediaStreamUIProxy> Create();
static std::unique_ptr<MediaStreamUIProxy> CreateForTests(
@@ -40,15 +40,15 @@ class CONTENT_EXPORT MediaStreamUIProxy {
// |response_callback| is called when the WebContentsDelegate approves or
// denies request.
virtual void RequestAccess(std::unique_ptr<MediaStreamRequest> request,
- const ResponseCallback& response_callback);
+ ResponseCallback response_callback);
// Notifies the UI that the MediaStream has been started. Must be called after
// access has been approved using RequestAccess(). |stop_callback| is be
// called on the IO thread after the user has requests the stream to be
// stopped. |window_id_callback| is called on the IO thread with the platform-
// dependent window ID of the UI.
- virtual void OnStarted(const base::Closure& stop_callback,
- const WindowIdCallback& window_id_callback);
+ virtual void OnStarted(base::OnceClosure stop_callback,
+ WindowIdCallback window_id_callback);
void SetRenderFrameHostDelegateForTests(RenderFrameHostDelegate* delegate);
@@ -64,14 +64,13 @@ class CONTENT_EXPORT MediaStreamUIProxy {
const MediaStreamDevices& devices,
content::MediaStreamRequestResult result);
void ProcessStopRequestFromUI();
- void OnWindowId(const WindowIdCallback& window_id_callback,
+ void OnWindowId(WindowIdCallback window_id_callback,
gfx::NativeViewId* window_id);
- void OnCheckedAccess(const base::Callback<void(bool)>& callback,
- bool have_access);
+ void OnCheckedAccess(base::Callback<void(bool)> callback, bool have_access);
std::unique_ptr<Core, content::BrowserThread::DeleteOnUIThread> core_;
ResponseCallback response_callback_;
- base::Closure stop_callback_;
+ base::OnceClosure stop_callback_;
base::WeakPtrFactory<MediaStreamUIProxy> weak_factory_;
@@ -80,7 +79,7 @@ class CONTENT_EXPORT MediaStreamUIProxy {
class CONTENT_EXPORT FakeMediaStreamUIProxy : public MediaStreamUIProxy {
public:
- explicit FakeMediaStreamUIProxy();
+ FakeMediaStreamUIProxy();
~FakeMediaStreamUIProxy() override;
void SetAvailableDevices(const MediaStreamDevices& devices);
@@ -89,9 +88,9 @@ class CONTENT_EXPORT FakeMediaStreamUIProxy : public MediaStreamUIProxy {
// MediaStreamUIProxy overrides.
void RequestAccess(std::unique_ptr<MediaStreamRequest> request,
- const ResponseCallback& response_callback) override;
- void OnStarted(const base::Closure& stop_callback,
- const WindowIdCallback& window_id_callback) override;
+ ResponseCallback response_callback) override;
+ void OnStarted(base::OnceClosure stop_callback,
+ WindowIdCallback window_id_callback) override;
private:
// This is used for RequestAccess().

Powered by Google App Engine
This is Rietveld 408576698