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

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

Issue 10537099: add "always allow" option to the mediastream infobar and allow user to allow/not allow acces to devi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed sky's comment and replaced "Do not allow any site to" with "Do not allow sites to" 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: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 11dd64de24756a82d7bf2f03e18e506ebfbdea93..97c4de883fb7a1b230031eff69e7f4a82e1a5e07 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -64,6 +64,7 @@
#include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
#include "chrome/browser/intents/web_intents_util.h"
#include "chrome/browser/lifetime/application_lifetime.h"
+#include "chrome/browser/media/media_stream_devices_controller.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/platform_util.h"
@@ -3241,20 +3242,27 @@ void Browser::RequestMediaAccessPermission(
TabContents* tab = TabContents::FromWebContents(web_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;
+ for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
+ old_infobar = infobar_helper->GetInfoBarDelegateAt(i)->
+ AsMediaStreamInfoBarDelegate();
+ if (old_infobar)
+ break;
+ }
- InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
- request,
- callback);
- if (old_infobar)
- infobar_helper->ReplaceInfoBar(old_infobar, infobar);
- else
- infobar_helper->AddInfoBar(infobar);
+ InfoBarDelegate* infobar =
+ new MediaStreamInfoBarDelegate(infobar_helper, controller.release());
+ if (old_infobar)
+ infobar_helper->ReplaceInfoBar(old_infobar, infobar);
+ else
+ infobar_helper->AddInfoBar(infobar);
+ }
}
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698