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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 10542092: Refactor the content interface for RequestMediaAccessPermission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "chrome/browser/ui/extensions/shell_window.h" 111 #include "chrome/browser/ui/extensions/shell_window.h"
112 #include "chrome/browser/ui/find_bar/find_bar.h" 112 #include "chrome/browser/ui/find_bar/find_bar.h"
113 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 113 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
114 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 114 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
115 #include "chrome/browser/ui/fullscreen_controller.h" 115 #include "chrome/browser/ui/fullscreen_controller.h"
116 #include "chrome/browser/ui/global_error.h" 116 #include "chrome/browser/ui/global_error.h"
117 #include "chrome/browser/ui/global_error_service.h" 117 #include "chrome/browser/ui/global_error_service.h"
118 #include "chrome/browser/ui/global_error_service_factory.h" 118 #include "chrome/browser/ui/global_error_service_factory.h"
119 #include "chrome/browser/ui/hung_plugin_tab_helper.h" 119 #include "chrome/browser/ui/hung_plugin_tab_helper.h"
120 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" 120 #include "chrome/browser/ui/intents/web_intent_picker_controller.h"
121 #include "chrome/browser/ui/media_stream_infobar_delegate.h"
121 #include "chrome/browser/ui/omnibox/location_bar.h" 122 #include "chrome/browser/ui/omnibox/location_bar.h"
122 #include "chrome/browser/ui/panels/panel.h" 123 #include "chrome/browser/ui/panels/panel.h"
123 #include "chrome/browser/ui/panels/panel_manager.h" 124 #include "chrome/browser/ui/panels/panel_manager.h"
124 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 125 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
125 #include "chrome/browser/ui/status_bubble.h" 126 #include "chrome/browser/ui/status_bubble.h"
126 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" 127 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h"
127 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 128 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
128 #include "chrome/browser/ui/tab_contents/tab_contents.h" 129 #include "chrome/browser/ui/tab_contents/tab_contents.h"
129 #include "chrome/browser/ui/tabs/dock_info.h" 130 #include "chrome/browser/ui/tabs/dock_info.h"
130 #include "chrome/browser/ui/tabs/tab_finder.h" 131 #include "chrome/browser/ui/tabs/tab_finder.h"
(...skipping 3560 matching lines...) Expand 10 before | Expand all | Expand 10 after
3691 bool last_unlocked_by_target) { 3692 bool last_unlocked_by_target) {
3692 fullscreen_controller_->RequestToLockMouse(web_contents, 3693 fullscreen_controller_->RequestToLockMouse(web_contents,
3693 user_gesture, 3694 user_gesture,
3694 last_unlocked_by_target); 3695 last_unlocked_by_target);
3695 } 3696 }
3696 3697
3697 void Browser::LostMouseLock() { 3698 void Browser::LostMouseLock() {
3698 fullscreen_controller_->LostMouseLock(); 3699 fullscreen_controller_->LostMouseLock();
3699 } 3700 }
3700 3701
3702 void Browser::RequestMediaAccessPermission(
3703 content::WebContents* web_contents,
3704 const content::MediaStreamRequest* request,
3705 const content::MediaResponseCallback& callback) {
3706 TabContents* tab = TabContents::FromWebContents(web_contents);
3707 DCHECK(tab);
3708
3709 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
3710 InfoBarDelegate* old_infobar = NULL;
3711 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) {
3712 old_infobar =
3713 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate();
3714 }
3715
3716 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
3717 request,
3718 callback);
3719 if (old_infobar)
3720 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
3721 else
3722 infobar_helper->AddInfoBar(infobar);
3723 }
3724
3701 /////////////////////////////////////////////////////////////////////////////// 3725 ///////////////////////////////////////////////////////////////////////////////
3702 // Browser, CoreTabHelperDelegate implementation: 3726 // Browser, CoreTabHelperDelegate implementation:
3703 3727
3704 void Browser::SwapTabContents(TabContents* old_tab_contents, 3728 void Browser::SwapTabContents(TabContents* old_tab_contents,
3705 TabContents* new_tab_contents) { 3729 TabContents* new_tab_contents) {
3706 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); 3730 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents);
3707 DCHECK_NE(TabStripModel::kNoTab, index); 3731 DCHECK_NE(TabStripModel::kNoTab, index);
3708 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); 3732 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents);
3709 } 3733 }
3710 3734
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 if (contents && !allow_js_access) { 5212 if (contents && !allow_js_access) {
5189 contents->web_contents()->GetController().LoadURL( 5213 contents->web_contents()->GetController().LoadURL(
5190 target_url, 5214 target_url,
5191 content::Referrer(), 5215 content::Referrer(),
5192 content::PAGE_TRANSITION_LINK, 5216 content::PAGE_TRANSITION_LINK,
5193 std::string()); // No extra headers. 5217 std::string()); // No extra headers.
5194 } 5218 }
5195 5219
5196 return contents != NULL; 5220 return contents != NULL;
5197 } 5221 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/extensions/shell_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698