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

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: . 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.h" 70 #include "chrome/browser/ui/tab_contents/tab_contents.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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 1091
1093 void ChromeContentBrowserClient::AddNewCertificate( 1092 void ChromeContentBrowserClient::AddNewCertificate(
1094 net::URLRequest* request, 1093 net::URLRequest* request,
1095 net::X509Certificate* cert, 1094 net::X509Certificate* cert,
1096 int render_process_id, 1095 int render_process_id,
1097 int render_view_id) { 1096 int render_view_id) {
1098 // The handler will run the UI and delete itself when it's finished. 1097 // The handler will run the UI and delete itself when it's finished.
1099 new SSLAddCertHandler(request, cert, render_process_id, render_view_id); 1098 new SSLAddCertHandler(request, cert, render_process_id, render_view_id);
1100 } 1099 }
1101 1100
1102 void ChromeContentBrowserClient::RequestMediaAccessPermission(
1103 const content::MediaStreamRequest* request,
1104 const content::MediaResponseCallback& callback) {
1105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1106
1107 WebContents* contents = tab_util::GetWebContentsByID(
1108 request->render_process_id, request->render_view_id);
1109 if (!contents) {
1110 // Abort, if the tab was closed after the request was made but before we
1111 // got to this point.
1112 callback.Run(content::MediaStreamDevices());
1113 return;
1114 }
1115
1116 TabContents* tab = TabContents::FromWebContents(contents);
1117 DCHECK(tab);
1118
1119 InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
1120 InfoBarDelegate* old_infobar = NULL;
1121 for (size_t i = 0; i < infobar_helper->infobar_count() && !old_infobar; ++i) {
1122 old_infobar =
1123 infobar_helper->GetInfoBarDelegateAt(i)->AsMediaStreamInfoBarDelegate();
1124 }
1125
1126 InfoBarDelegate* infobar = new MediaStreamInfoBarDelegate(infobar_helper,
1127 request,
1128 callback);
1129 if (old_infobar)
1130 infobar_helper->ReplaceInfoBar(old_infobar, infobar);
1131 else
1132 infobar_helper->AddInfoBar(infobar);
1133 }
1134
1135 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { 1101 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() {
1136 return MediaInternals::GetInstance(); 1102 return MediaInternals::GetInstance();
1137 } 1103 }
1138 1104
1139 void ChromeContentBrowserClient::RequestDesktopNotificationPermission( 1105 void ChromeContentBrowserClient::RequestDesktopNotificationPermission(
1140 const GURL& source_origin, 1106 const GURL& source_origin,
1141 int callback_context, 1107 int callback_context,
1142 int render_process_id, 1108 int render_process_id,
1143 int render_view_id) { 1109 int render_view_id) {
1144 #if defined(ENABLE_NOTIFICATIONS) 1110 #if defined(ENABLE_NOTIFICATIONS)
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 #if defined(USE_NSS) 1571 #if defined(USE_NSS)
1606 crypto::CryptoModuleBlockingPasswordDelegate* 1572 crypto::CryptoModuleBlockingPasswordDelegate*
1607 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1573 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1608 const GURL& url) { 1574 const GURL& url) {
1609 return browser::NewCryptoModuleBlockingDialogDelegate( 1575 return browser::NewCryptoModuleBlockingDialogDelegate(
1610 browser::kCryptoModulePasswordKeygen, url.host()); 1576 browser::kCryptoModulePasswordKeygen, url.host());
1611 } 1577 }
1612 #endif 1578 #endif
1613 1579
1614 } // namespace chrome 1580 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/profiles/profile_impl_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698