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 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 fullscreen_controller_->LostMouseLock(); | 3235 fullscreen_controller_->LostMouseLock(); |
3235 } | 3236 } |
3236 | 3237 |
3237 void Browser::RequestMediaAccessPermission( | 3238 void Browser::RequestMediaAccessPermission( |
3238 content::WebContents* web_contents, | 3239 content::WebContents* web_contents, |
3239 const content::MediaStreamRequest* request, | 3240 const content::MediaStreamRequest* request, |
3240 const content::MediaResponseCallback& callback) { | 3241 const content::MediaResponseCallback& callback) { |
3241 TabContents* tab = TabContents::FromWebContents(web_contents); | 3242 TabContents* tab = TabContents::FromWebContents(web_contents); |
3242 DCHECK(tab); | 3243 DCHECK(tab); |
3243 | 3244 |
3244 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); | 3245 scoped_ptr<MediaStreamDevicesController> |
3245 InfoBarDelegate* old_infobar = NULL; | 3246 controller(new MediaStreamDevicesController(tab->profile(), |
3246 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) { | 3247 request, |
3247 old_infobar = | 3248 callback)); |
3248 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate(); | 3249 if (!controller->DismissInfoBarAndTakeActionOnSettings()) { |
| 3250 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper(); |
| 3251 InfoBarDelegate* old_infobar = NULL; |
| 3252 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
| 3253 old_infobar = infobar_helper->GetInfoBarDelegateAt(i)-> |
| 3254 AsMediaStreamInfoBarDelegate(); |
| 3255 if (old_infobar) |
| 3256 break; |
| 3257 } |
| 3258 |
| 3259 InfoBarDelegate* infobar = |
| 3260 new MediaStreamInfoBarDelegate(infobar_helper, controller.release()); |
| 3261 if (old_infobar) |
| 3262 infobar_helper->ReplaceInfoBar(old_infobar, infobar); |
| 3263 else |
| 3264 infobar_helper->AddInfoBar(infobar); |
3249 } | 3265 } |
3250 | |
3251 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper, | |
3252 request, | |
3253 callback); | |
3254 if (old_infobar) | |
3255 infobar_helper->ReplaceInfoBar(old_infobar, infobar); | |
3256 else | |
3257 infobar_helper->AddInfoBar(infobar); | |
3258 } | 3266 } |
3259 | 3267 |
3260 /////////////////////////////////////////////////////////////////////////////// | 3268 /////////////////////////////////////////////////////////////////////////////// |
3261 // Browser, CoreTabHelperDelegate implementation: | 3269 // Browser, CoreTabHelperDelegate implementation: |
3262 | 3270 |
3263 void Browser::SwapTabContents(TabContents* old_tab_contents, | 3271 void Browser::SwapTabContents(TabContents* old_tab_contents, |
3264 TabContents* new_tab_contents) { | 3272 TabContents* new_tab_contents) { |
3265 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); | 3273 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); |
3266 DCHECK_NE(TabStripModel::kNoTab, index); | 3274 DCHECK_NE(TabStripModel::kNoTab, index); |
3267 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); | 3275 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); |
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4744 if (contents && !allow_js_access) { | 4752 if (contents && !allow_js_access) { |
4745 contents->web_contents()->GetController().LoadURL( | 4753 contents->web_contents()->GetController().LoadURL( |
4746 target_url, | 4754 target_url, |
4747 content::Referrer(), | 4755 content::Referrer(), |
4748 content::PAGE_TRANSITION_LINK, | 4756 content::PAGE_TRANSITION_LINK, |
4749 std::string()); // No extra headers. | 4757 std::string()); // No extra headers. |
4750 } | 4758 } |
4751 | 4759 |
4752 return contents != NULL; | 4760 return contents != NULL; |
4753 } | 4761 } |
OLD | NEW |