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

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: actually remove typedef 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 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 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 bool last_unlocked_by_target) { 3679 bool last_unlocked_by_target) {
3679 fullscreen_controller_->RequestToLockMouse(tab, 3680 fullscreen_controller_->RequestToLockMouse(tab,
3680 user_gesture, 3681 user_gesture,
3681 last_unlocked_by_target); 3682 last_unlocked_by_target);
3682 } 3683 }
3683 3684
3684 void Browser::LostMouseLock() { 3685 void Browser::LostMouseLock() {
3685 fullscreen_controller_->LostMouseLock(); 3686 fullscreen_controller_->LostMouseLock();
3686 } 3687 }
3687 3688
3689 void Browser::RequestMediaAccessPermission(
3690 content::WebContents* web_contents,
3691 const content::MediaStreamRequest* request,
3692 const content::MediaResponseCallback& callback) {
3693 TabContents* tab = TabContents::FromWebContents(web_contents);
3694 DCHECK(tab);
3695
3696 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
3697 InfoBarDelegate* old_infobar = NULL;
3698 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) {
3699 old_infobar =
3700 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate();
3701 }
3702
3703 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
3704 request,
3705 callback);
3706 if (old_infobar)
3707 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
3708 else
3709 infobar_helper->AddInfoBar(infobar);
3710 }
3711
3688 /////////////////////////////////////////////////////////////////////////////// 3712 ///////////////////////////////////////////////////////////////////////////////
3689 // Browser, CoreTabHelperDelegate implementation: 3713 // Browser, CoreTabHelperDelegate implementation:
3690 3714
3691 void Browser::SwapTabContents(TabContents* old_tab_contents, 3715 void Browser::SwapTabContents(TabContents* old_tab_contents,
3692 TabContents* new_tab_contents) { 3716 TabContents* new_tab_contents) {
3693 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents); 3717 int index = tab_strip_model_->GetIndexOfTabContents(old_tab_contents);
3694 DCHECK_NE(TabStripModel::kNoTab, index); 3718 DCHECK_NE(TabStripModel::kNoTab, index);
3695 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents); 3719 tab_strip_model_->ReplaceTabContentsAt(index, new_tab_contents);
3696 } 3720 }
3697 3721
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
5172 if (contents && !allow_js_access) { 5196 if (contents && !allow_js_access) {
5173 contents->web_contents()->GetController().LoadURL( 5197 contents->web_contents()->GetController().LoadURL(
5174 target_url, 5198 target_url,
5175 content::Referrer(), 5199 content::Referrer(),
5176 content::PAGE_TRANSITION_LINK, 5200 content::PAGE_TRANSITION_LINK,
5177 std::string()); // No extra headers. 5201 std::string()); // No extra headers.
5178 } 5202 }
5179 5203
5180 return contents != NULL; 5204 return contents != NULL;
5181 } 5205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698