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

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

Issue 10542092: Refactor the content interface for RequestMediaAccessPermission. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h" 59 #include "chrome/browser/renderer_host/chrome_render_view_host_observer.h"
60 #include "chrome/browser/renderer_host/plugin_info_message_filter.h" 60 #include "chrome/browser/renderer_host/plugin_info_message_filter.h"
61 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h" 61 #include "chrome/browser/search_engines/search_provider_install_state_message_fi lter.h"
62 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" 62 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
63 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" 63 #include "chrome/browser/spellchecker/spellcheck_message_filter.h"
64 #include "chrome/browser/ssl/ssl_add_cert_handler.h" 64 #include "chrome/browser/ssl/ssl_add_cert_handler.h"
65 #include "chrome/browser/ssl/ssl_blocking_page.h" 65 #include "chrome/browser/ssl/ssl_blocking_page.h"
66 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" 66 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
67 #include "chrome/browser/tab_contents/tab_util.h" 67 #include "chrome/browser/tab_contents/tab_util.h"
68 #include "chrome/browser/toolkit_extra_parts.h" 68 #include "chrome/browser/toolkit_extra_parts.h"
69 #include "chrome/browser/ui/media_stream_infobar_delegate.h"
70 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" 69 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
71 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 70 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
72 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 71 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
73 #include "chrome/browser/user_style_sheet_watcher.h" 72 #include "chrome/browser/user_style_sheet_watcher.h"
74 #include "chrome/browser/user_style_sheet_watcher_factory.h" 73 #include "chrome/browser/user_style_sheet_watcher_factory.h"
75 #include "chrome/browser/view_type_utils.h" 74 #include "chrome/browser/view_type_utils.h"
76 #include "chrome/common/child_process_logging.h" 75 #include "chrome/common/child_process_logging.h"
77 #include "chrome/common/chrome_constants.h" 76 #include "chrome/common/chrome_constants.h"
78 #include "chrome/common/chrome_switches.h" 77 #include "chrome/common/chrome_switches.h"
79 #include "chrome/common/extensions/extension.h" 78 #include "chrome/common/extensions/extension.h"
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1093
1095 void ChromeContentBrowserClient::AddNewCertificate( 1094 void ChromeContentBrowserClient::AddNewCertificate(
1096 net::URLRequest* request, 1095 net::URLRequest* request,
1097 net::X509Certificate* cert, 1096 net::X509Certificate* cert,
1098 int render_process_id, 1097 int render_process_id,
1099 int render_view_id) { 1098 int render_view_id) {
1100 // The handler will run the UI and delete itself when it's finished. 1099 // The handler will run the UI and delete itself when it's finished.
1101 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); 1100 new SSLAddCertHandler(request, cert, render_process_id, render_view_id);
1102 } 1101 }
1103 1102
1104 void ChromeContentBrowserClient::RequestMediaAccessPermission(
1105 const content::MediaStreamRequest* request,
1106 const content::MediaResponseCallback& callback) {
1107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1108
1109 WebContents* contents = tab_util::GetWebContentsByID(
1110 request->render_process_id, request->render_view_id);
1111 if (!contents) {
1112 // Abort, if the tab was closed after the request was made but before we
1113 // got to this point.
1114 callback.Run(content::MediaStreamDevices());
1115 return;
1116 }
1117
Evan Stade 2012/06/09 05:47:38 it also would have been possible to just do conte
1118 TabContentsWrapper* tab =
1119 TabContentsWrapper::GetCurrentWrapperForContents(contents);
1120 DCHECK(tab);
1121
1122 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
1123 InfoBarDelegate* old_infobar = NULL;
1124 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) {
1125 old_infobar =
1126 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate();
1127 }
1128
1129 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
1130 request,
1131 callback);
1132 if (old_infobar)
1133 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
1134 else
1135 infobar_helper->AddInfoBar(infobar);
1136 }
1137
1138 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { 1103 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() {
1139 return MediaInternals::GetInstance(); 1104 return MediaInternals::GetInstance();
1140 } 1105 }
1141 1106
1142 void ChromeContentBrowserClient::RequestDesktopNotificationPermission( 1107 void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
1143 const GURL& source_origin, 1108 const GURL& source_origin,
1144 int callback_context, 1109 int callback_context,
1145 int render_process_id, 1110 int render_process_id,
1146 int render_view_id) { 1111 int render_view_id) {
1147 #if defined(ENABLE_NOTIFICATIONS) 1112 #if defined(ENABLE_NOTIFICATIONS)
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 #if defined(USE_NSS) 1573 #if defined(USE_NSS)
1609 crypto::CryptoModuleBlockingPasswordDelegate* 1574 crypto::CryptoModuleBlockingPasswordDelegate*
1610 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1575 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1611 const GURL& url) { 1576 const GURL& url) {
1612 return browser::NewCryptoModuleBlockingDialogDelegate( 1577 return browser::NewCryptoModuleBlockingDialogDelegate(
1613 browser::kCryptoModulePasswordKeygen, url.host()); 1578 browser::kCryptoModulePasswordKeygen, url.host());
1614 } 1579 }
1615 #endif 1580 #endif
1616 1581
1617 } // namespace chrome 1582 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698