Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 initial_pos, user_gesture); | 633 initial_pos, user_gesture); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void ExtensionHost::RenderViewReady() { | 636 void ExtensionHost::RenderViewReady() { |
| 637 content::NotificationService::current()->Notify( | 637 content::NotificationService::current()->Notify( |
| 638 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 638 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 639 content::Source<Profile>(profile_), | 639 content::Source<Profile>(profile_), |
| 640 content::Details<ExtensionHost>(this)); | 640 content::Details<ExtensionHost>(this)); |
| 641 } | 641 } |
| 642 | 642 |
| 643 void ExtensionHost::RequestMediaAccessPermission( | |
| 644 content::WebContents* web_contents, | |
| 645 const content::MediaStreamRequest* request, | |
| 646 const content::MediaResponseCallback& callback) { | |
| 647 content::MediaStreamDevices devices; | |
| 648 | |
| 649 bool accepted_an_audio_device = false; | |
| 650 bool accepted_a_video_device = false; | |
| 651 for (content::MediaStreamDeviceMap::const_iterator it = | |
| 652 request->devices.begin(); it != request->devices.end(); ++it) { | |
| 653 if (!accepted_an_audio_device && content::IsAudioMediaType(it->first) && | |
|
no longer working on chromium
2012/10/18 08:36:17
fix the alignment to help readability.
If (*** &&
justinlin
2012/10/18 09:33:29
Done.
| |
| 654 !it->second.empty()) { | |
| 655 // For tab capture, we require the tabCapture permission. | |
| 656 if (it->first != content::MEDIA_TAB_AUDIO_CAPTURE || | |
|
no longer working on chromium
2012/10/18 08:36:17
I don't understand here, shouldn't it be
it->first
justinlin
2012/10/18 09:33:29
Sorry if this is confusing. We add the device if i
| |
| 657 extension()->HasAPIPermission(APIPermission::kTabCapture)) { | |
| 658 devices.push_back(it->second.front()); | |
| 659 accepted_an_audio_device = true; | |
| 660 } | |
| 661 } else if (!accepted_a_video_device && | |
| 662 content::IsVideoMediaType(it->first) && !it->second.empty()) { | |
| 663 if (it->first != content::MEDIA_TAB_VIDEO_CAPTURE || | |
| 664 extension()->HasAPIPermission(APIPermission::kTabCapture)) { | |
| 665 devices.push_back(it->second.front()); | |
| 666 accepted_a_video_device = true; | |
| 667 } | |
| 668 } | |
| 669 } | |
| 670 | |
| 671 callback.Run(devices); | |
| 672 } | |
| 673 | |
| 643 } // namespace extensions | 674 } // namespace extensions |
| OLD | NEW |