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

Unified Diff: chrome/browser/ui/browser.cc

Issue 2642763003: Remove chrome/browser/ui/media_utils.{cc|h} (Closed)
Patch Set: rebase and address review comments Created 3 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/media_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index f136d01a35148a06a3a2101951b406bbb3688482..3abed6c03e97efdec77f487d398acf3f4d424355 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -123,7 +123,6 @@
#include "chrome/browser/ui/global_error/global_error_service_factory.h"
#include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
-#include "chrome/browser/ui/media_utils.h"
#include "chrome/browser/ui/search/search_delegate.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
@@ -262,6 +261,23 @@ bool IsFastTabUnloadEnabled() {
switches::kEnableFastUnload);
}
+const extensions::Extension* GetExtensionForOrigin(
+ Profile* profile,
+ const GURL& security_origin) {
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ if (!security_origin.SchemeIs(extensions::kExtensionScheme))
+ return nullptr;
+
+ const extensions::Extension* extension =
+ extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(
+ security_origin.host());
+ DCHECK(extension);
+ return extension;
+#else
+ return nullptr;
+#endif
+}
+
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -1821,13 +1837,22 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
- ::RequestMediaAccessPermission(web_contents, profile_, request, callback);
+ const extensions::Extension* extension =
+ GetExtensionForOrigin(profile_, request.security_origin);
+ MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
+ web_contents, request, callback, extension);
}
bool Browser::CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin,
content::MediaStreamType type) {
- return ::CheckMediaAccessPermission(web_contents, security_origin, type);
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ const extensions::Extension* extension =
+ GetExtensionForOrigin(profile, security_origin);
+ return MediaCaptureDevicesDispatcher::GetInstance()
+ ->CheckMediaAccessPermission(web_contents, security_origin, type,
+ extension);
}
std::string Browser::GetDefaultMediaDeviceID(content::WebContents* web_contents,
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/media_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698