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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "chrome/browser/favicon/favicon_tab_helper.h" 57 #include "chrome/browser/favicon/favicon_tab_helper.h"
58 #include "chrome/browser/file_select_helper.h" 58 #include "chrome/browser/file_select_helper.h"
59 #include "chrome/browser/first_run/first_run.h" 59 #include "chrome/browser/first_run/first_run.h"
60 #include "chrome/browser/google/google_url_tracker.h" 60 #include "chrome/browser/google/google_url_tracker.h"
61 #include "chrome/browser/infobars/infobar_tab_helper.h" 61 #include "chrome/browser/infobars/infobar_tab_helper.h"
62 #include "chrome/browser/instant/instant_controller.h" 62 #include "chrome/browser/instant/instant_controller.h"
63 #include "chrome/browser/instant/instant_unload_handler.h" 63 #include "chrome/browser/instant/instant_unload_handler.h"
64 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 64 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
65 #include "chrome/browser/intents/web_intents_util.h" 65 #include "chrome/browser/intents/web_intents_util.h"
66 #include "chrome/browser/lifetime/application_lifetime.h" 66 #include "chrome/browser/lifetime/application_lifetime.h"
67 #include "chrome/browser/media/media_stream_devices_controller.h"
67 #include "chrome/browser/net/url_fixer_upper.h" 68 #include "chrome/browser/net/url_fixer_upper.h"
68 #include "chrome/browser/notifications/notification_ui_manager.h" 69 #include "chrome/browser/notifications/notification_ui_manager.h"
69 #include "chrome/browser/platform_util.h" 70 #include "chrome/browser/platform_util.h"
70 #include "chrome/browser/prefs/incognito_mode_prefs.h" 71 #include "chrome/browser/prefs/incognito_mode_prefs.h"
71 #include "chrome/browser/prefs/pref_service.h" 72 #include "chrome/browser/prefs/pref_service.h"
72 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 73 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
73 #include "chrome/browser/printing/print_preview_tab_controller.h" 74 #include "chrome/browser/printing/print_preview_tab_controller.h"
74 #include "chrome/browser/printing/print_view_manager.h" 75 #include "chrome/browser/printing/print_view_manager.h"
75 #include "chrome/browser/profiles/profile.h" 76 #include "chrome/browser/profiles/profile.h"
76 #include "chrome/browser/profiles/profile_destroyer.h" 77 #include "chrome/browser/profiles/profile_destroyer.h"
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after
3696 fullscreen_controller_->LostMouseLock(); 3697 fullscreen_controller_->LostMouseLock();
3697 } 3698 }
3698 3699
3699 void Browser::RequestMediaAccessPermission( 3700 void Browser::RequestMediaAccessPermission(
3700 content::WebContents* web_contents, 3701 content::WebContents* web_contents,
3701 const content::MediaStreamRequest* request, 3702 const content::MediaStreamRequest* request,
3702 const content::MediaResponseCallback& callback) { 3703 const content::MediaResponseCallback& callback) {
3703 TabContents* tab = TabContents::FromWebContents(web_contents); 3704 TabContents* tab = TabContents::FromWebContents(web_contents);
3704 DCHECK(tab); 3705 DCHECK(tab);
3705 3706
3706 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); 3707 scoped_ptr<MediaStreamDevicesController>
3707 InfoBarDelegate* old_infobar = NULL; 3708 controller(new MediaStreamDevicesController(tab->profile(),
3708 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) { 3709 request,
3709 old_infobar = 3710 callback));
3710 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate(); 3711 if (!controller->DismissInfoBarAndTakeActionOnSettings()) {
3712 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
3713 InfoBarDelegate* old_infobar = NULL;
3714 size_t i = 0;
3715 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.
3716 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.
3717 AsMediaStreamInfoBarDelegate();
3718 }
3719
3720 InfoBarDelegate* infobar =
3721 new MediaStreamInfoBarDelegate(infobar_helper, controller.release());
3722 if (old_infobar)
3723 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
3724 else
3725 infobar_helper->AddInfoBar(infobar);
3711 } 3726 }
3712
3713 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
3714 request,
3715 callback);
3716 if (old_infobar)
3717 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
3718 else
3719 infobar_helper->AddInfoBar(infobar);
3720 } 3727 }
3721 3728
3722 /////////////////////////////////////////////////////////////////////////////// 3729 ///////////////////////////////////////////////////////////////////////////////
3723 // Browser, CoreTabHelperDelegate implementation: 3730 // Browser, CoreTabHelperDelegate implementation:
3724 3731
3725 void Browser::SwapTabContents(TabContents* old_tab_contents, 3732 void Browser::SwapTabContents(TabContents* old_tab_contents,
3726 TabContents* new_tab_contents) { 3733 TabContents* new_tab_contents) {
3727 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); 3734 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents);
3728 DCHECK_NE(TabStripModel::kNoTab, index); 3735 DCHECK_NE(TabStripModel::kNoTab, index);
3729 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); 3736 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents);
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
5230 if (contents && !allow_js_access) { 5237 if (contents && !allow_js_access) {
5231 contents->web_contents()->GetController().LoadURL( 5238 contents->web_contents()->GetController().LoadURL(
5232 target_url, 5239 target_url,
5233 content::Referrer(), 5240 content::Referrer(),
5234 content::PAGE_TRANSITION_LINK, 5241 content::PAGE_TRANSITION_LINK,
5235 std::string()); // No extra headers. 5242 std::string()); // No extra headers.
5236 } 5243 }
5237 5244
5238 return contents != NULL; 5245 return contents != NULL;
5239 } 5246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698