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

Unified Diff: content/browser/renderer_host/media/media_stream_device_settings.cc

Issue 10542092: Refactor the content interface for RequestMediaAccessPermission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 8 years, 6 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_device_settings.cc
diff --git a/content/browser/renderer_host/media/media_stream_device_settings.cc b/content/browser/renderer_host/media/media_stream_device_settings.cc
index 39d66e7a5b2693abfd124a9638a65eb6eed3e67f..d0ec2e600935a638874012c61b6bbed322c82533 100644
--- a/content/browser/renderer_host/media/media_stream_device_settings.cc
+++ b/content/browser/renderer_host/media/media_stream_device_settings.cc
@@ -10,6 +10,8 @@
#include "base/callback.h"
#include "base/stl_util.h"
#include "content/browser/renderer_host/media/media_stream_settings_requester.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
+#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/common/media/media_stream_options.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
@@ -322,19 +324,33 @@ void MediaStreamDeviceSettings::PostRequestToUi(const std::string& label) {
}
}
- // Send the permission request to the content client.
scoped_refptr<ResponseCallbackHelper> helper =
new ResponseCallbackHelper(AsWeakPtr());
content::MediaResponseCallback callback =
base::Bind(&ResponseCallbackHelper::PostResponse,
helper.get(), label);
+
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(
- &content::ContentBrowserClient::RequestMediaAccessPermission,
- base::Unretained(content::GetContentClient()->browser()),
- request, callback));
+ base::Bind(&MediaStreamDeviceSettings::DoRequest,
+ base::Unretained(this), request, callback));
+}
+
+void MediaStreamDeviceSettings::DoRequest(
jochen (gone - plz use gerrit) 2012/06/09 07:55:21 could this be a helper function in an anon namespa
Evan Stade 2012/06/12 00:00:46 indeed I suppose it could
+ const MediaStreamDeviceSettingsRequest* request,
+ const content::MediaResponseCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // Send the permission request to the web contents.
+ content::RenderViewHostImpl* host =
+ content::RenderViewHostImpl::FromID(request->render_process_id,
+ request->render_view_id);
+
+ // Tab may have gone away.
+ if (!host || !host->GetDelegate())
+ callback.Run(content::MediaStreamDevices());
+ host->GetDelegate()->RequestMediaAccessPermission(request, callback);
}
} // namespace media_stream

Powered by Google App Engine
This is Rietveld 408576698