Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index 9cc0a79944806e2daa6dd7185fed86358a6b6f59..7c71c9ea041706e2adc70b6d305db6fd6ce36eaf 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -40,6 +40,7 @@ |
#include "chrome/browser/gpu_util.h" |
#include "chrome/browser/infobars/infobar_tab_helper.h" |
#include "chrome/browser/media/media_internals.h" |
+#include "chrome/browser/media/media_stream_devices_controller.h" |
#include "chrome/browser/net/chrome_net_log.h" |
#include "chrome/browser/notifications/desktop_notification_service.h" |
#include "chrome/browser/notifications/desktop_notification_service_factory.h" |
@@ -1118,20 +1119,28 @@ void ChromeContentBrowserClient::RequestMediaAccessPermission( |
TabContentsWrapper::GetCurrentWrapperForContents(contents); |
DCHECK(tab); |
- InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); |
- InfoBarDelegate* old_infobar = NULL; |
- for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) { |
- old_infobar = |
- infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate(); |
- } |
+ scoped_ptr<MediaStreamDevicesController> |
+ controller(new MediaStreamDevicesController(tab->profile(), |
+ request, |
+ callback)); |
+ if (!controller->DismissInfoBarAndTakeActionOnSettings()) { |
+ InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); |
+ InfoBarDelegate* old_infobar = NULL; |
+ size_t i = 0; |
+ for (; i < infobar_helper->infobar_count() && !old_infobar; ++i) { |
+ old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> |
+ AsMediaStreamInfoBarDelegate(); |
+ } |
- InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper, |
- request, |
- callback); |
- if (old_infobar) |
- infobar_helper->ReplaceInfoBar(old_infobar, infobar); |
- else |
- infobar_helper->AddInfoBar(infobar); |
+ // The MediaStreamInfoBarDelegate will take the ownership of the controller; |
+ MediaStreamInfoBarDelegate* infobar = |
+ new MediaStreamInfoBarDelegate(infobar_helper, |
+ controller.release()); |
+ if (old_infobar) |
+ infobar_helper->ReplaceInfoBar(old_infobar, infobar); |
+ else |
+ infobar_helper->AddInfoBar(infobar); |
+ } |
} |
content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { |