Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / media_utils.cc
bloba764d5ba2dd8fb8d405d6e3eb86e6c01f55401b7
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/media_utils.h"
7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
10 #include "extensions/common/constants.h"
12 class Profile;
14 namespace content {
15 class WebContents;
18 void RequestMediaAccessPermission(
19 content::WebContents* web_contents,
20 Profile* profile,
21 const content::MediaStreamRequest& request,
22 const content::MediaResponseCallback& callback) {
23 const extensions::Extension* extension = NULL;
24 GURL origin(request.security_origin);
25 if (origin.SchemeIs(extensions::kExtensionScheme)) {
26 ExtensionService* extensions_service =
27 extensions::ExtensionSystem::Get(profile)->extension_service();
28 extension = extensions_service->extensions()->GetByID(origin.host());
29 DCHECK(extension);
32 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
33 web_contents, request, callback, extension);