OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2251 MediaStreamInfoBarDelegate* media_stream_infobar; | 2251 MediaStreamInfoBarDelegate* media_stream_infobar; |
2252 if (!(media_stream_infobar = infobar->AsMediaStreamInfoBarDelegate())) { | 2252 if (!(media_stream_infobar = infobar->AsMediaStreamInfoBarDelegate())) { |
2253 reply.SendError("Not a media stream infobar."); | 2253 reply.SendError("Not a media stream infobar."); |
2254 return; | 2254 return; |
2255 } | 2255 } |
2256 if ("allow" == action) { | 2256 if ("allow" == action) { |
2257 content::MediaStreamDevices video_devices = | 2257 content::MediaStreamDevices video_devices = |
2258 media_stream_infobar->GetVideoDevices(); | 2258 media_stream_infobar->GetVideoDevices(); |
2259 content::MediaStreamDevices audio_devices = | 2259 content::MediaStreamDevices audio_devices = |
2260 media_stream_infobar->GetAudioDevices(); | 2260 media_stream_infobar->GetAudioDevices(); |
2261 if (video_devices.empty() || audio_devices.empty()) { | 2261 |
phoglund_chromium
2012/11/29 10:11:36
HasVideo() == true -> web page actually requested
| |
2262 reply.SendError("No available audio/video devices to autoselect."); | 2262 if (media_stream_infobar->HasVideo() && video_devices.empty()) { |
2263 reply.SendError("Requested video, but there are no video " | |
2264 "devices on the system."); | |
2265 return; | |
2266 } | |
2267 if (media_stream_infobar->HasAudio() && audio_devices.empty()) { | |
2268 reply.SendError("Requested audio, but there are no audio " | |
2269 "devices on the system."); | |
2263 return; | 2270 return; |
2264 } | 2271 } |
2265 | 2272 |
2266 media_stream_infobar->Accept(); | 2273 media_stream_infobar->Accept(); |
2267 infobar_helper->RemoveInfoBar(infobar); | 2274 infobar_helper->RemoveInfoBar(infobar); |
2268 } else if ("deny" == action) { | 2275 } else if ("deny" == action) { |
2269 media_stream_infobar->Deny(); | 2276 media_stream_infobar->Deny(); |
2270 infobar_helper->RemoveInfoBar(infobar); | 2277 infobar_helper->RemoveInfoBar(infobar); |
2271 } | 2278 } |
2272 reply.SendSuccess(NULL); | 2279 reply.SendSuccess(NULL); |
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6351 if (g_browser_process) | 6358 if (g_browser_process) |
6352 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6353 } | 6360 } |
6354 | 6361 |
6355 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6356 WebContents* tab) { | 6363 WebContents* tab) { |
6357 TabStripModel* tab_strip = browser->tab_strip_model(); | 6364 TabStripModel* tab_strip = browser->tab_strip_model(); |
6358 if (tab_strip->GetActiveWebContents() != tab) | 6365 if (tab_strip->GetActiveWebContents() != tab) |
6359 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
6360 } | 6367 } |
OLD | NEW |