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

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: Check the exceptions before the default setting, sites in the exceptions list can access the device… 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 f5f7d91ba8a62aced0d26cd8da29eb40904228bd..351f44a6c0a45ef1d6fa2d346af661111ab4e7ba 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"
@@ -3703,20 +3704,26 @@ 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;
+ size_t i = 0;
+ for (; i < infobar_helper->infobar_count() && !old_infobar; ++i) {
Bernhard Bauer 2012/06/18 17:38:15 Inline the declaration of |i| into the for-loop?
no longer working on chromium 2012/06/19 12:23:17 Done.
+ old_infobar = infobar_helper->GetInfoBarDelegateAt(i)->
Bernhard Bauer 2012/06/18 17:38:15 If you |break| here soon as |old_infobar| is not N
no longer working on chromium 2012/06/19 12:23:17 Done.
+ AsMediaStreamInfoBarDelegate();
+ }
- 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