OLD | NEW |
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 Loading... |
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 3615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3692 fullscreen_controller_->LostMouseLock(); | 3693 fullscreen_controller_->LostMouseLock(); |
3693 } | 3694 } |
3694 | 3695 |
3695 void Browser::RequestMediaAccessPermission( | 3696 void Browser::RequestMediaAccessPermission( |
3696 content::WebContents* web_contents, | 3697 content::WebContents* web_contents, |
3697 const content::MediaStreamRequest* request, | 3698 const content::MediaStreamRequest* request, |
3698 const content::MediaResponseCallback& callback) { | 3699 const content::MediaResponseCallback& callback) { |
3699 TabContents* tab = TabContents::FromWebContents(web_contents); | 3700 TabContents* tab = TabContents::FromWebContents(web_contents); |
3700 DCHECK(tab); | 3701 DCHECK(tab); |
3701 | 3702 |
3702 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); | 3703 scoped_ptr<MediaStreamDevicesController> |
3703 InfoBarDelegate* old_infobar = NULL; | 3704 controller(new MediaStreamDevicesController(tab->profile(), |
3704 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) { | 3705 request, |
3705 old_infobar = | 3706 callback)); |
3706 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate(); | 3707 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { |
| 3708 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); |
| 3709 InfoBarDelegate* old_infobar = NULL; |
| 3710 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
| 3711 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> |
| 3712 AsMediaStreamInfoBarDelegate(); |
| 3713 if (old_infobar) |
| 3714 break; |
| 3715 } |
| 3716 |
| 3717 InfoBarDelegate* infobar = |
| 3718 new MediaStreamInfoBarDelegate(infobar_helper, controller.release()); |
| 3719 if (old_infobar) |
| 3720 infobar_helper->ReplaceInfoBar(old_infobar, infobar); |
| 3721 else |
| 3722 infobar_helper->AddInfoBar(infobar); |
3707 } | 3723 } |
3708 | |
3709 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper, | |
3710 request, | |
3711 callback); | |
3712 if (old_infobar) | |
3713 infobar_helper->ReplaceInfoBar(old_infobar, infobar); | |
3714 else | |
3715 infobar_helper->AddInfoBar(infobar); | |
3716 } | 3724 } |
3717 | 3725 |
3718 /////////////////////////////////////////////////////////////////////////////// | 3726 /////////////////////////////////////////////////////////////////////////////// |
3719 // Browser, CoreTabHelperDelegate implementation: | 3727 // Browser, CoreTabHelperDelegate implementation: |
3720 | 3728 |
3721 void Browser::SwapTabContents(TabContents* old_tab_contents, | 3729 void Browser::SwapTabContents(TabContents* old_tab_contents, |
3722 TabContents* new_tab_contents) { | 3730 TabContents* new_tab_contents) { |
3723 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); | 3731 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); |
3724 DCHECK_NE(TabStripModel::kNoTab, index); | 3732 DCHECK_NE(TabStripModel::kNoTab, index); |
3725 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); | 3733 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5226 if (contents && !allow_js_access) { | 5234 if (contents && !allow_js_access) { |
5227 contents->web_contents()->GetController().LoadURL( | 5235 contents->web_contents()->GetController().LoadURL( |
5228 target_url, | 5236 target_url, |
5229 content::Referrer(), | 5237 content::Referrer(), |
5230 content::PAGE_TRANSITION_LINK, | 5238 content::PAGE_TRANSITION_LINK, |
5231 std::string()); // No extra headers. | 5239 std::string()); // No extra headers. |
5232 } | 5240 } |
5233 | 5241 |
5234 return contents != NULL; | 5242 return contents != NULL; |
5235 } | 5243 } |
OLD | NEW |