| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/api/webrtc_audio_private/webrtc_audio_privat
e_api.h" | 5 #include "chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_privat
e_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_tab_util.h" | 12 #include "chrome/browser/extensions/extension_tab_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "content/public/browser/media_device_id.h" | 14 #include "content/public/browser/media_device_id.h" |
| 15 #include "content/public/browser/resource_context.h" | 15 #include "content/public/browser/resource_context.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "extensions/browser/event_router.h" | 17 #include "extensions/browser/event_router.h" |
| 18 #include "extensions/browser/extension_system.h" | 18 #include "extensions/browser/extension_system.h" |
| 19 #include "extensions/common/error_utils.h" | 19 #include "extensions/common/error_utils.h" |
| 20 #include "extensions/common/permissions/permissions_data.h" |
| 20 #include "media/audio/audio_manager_base.h" | 21 #include "media/audio/audio_manager_base.h" |
| 21 #include "media/audio/audio_output_controller.h" | 22 #include "media/audio/audio_output_controller.h" |
| 22 | 23 |
| 23 namespace extensions { | 24 namespace extensions { |
| 24 | 25 |
| 25 using content::BrowserThread; | 26 using content::BrowserThread; |
| 26 using content::RenderViewHost; | 27 using content::RenderViewHost; |
| 27 using media::AudioDeviceNames; | 28 using media::AudioDeviceNames; |
| 28 using media::AudioManager; | 29 using media::AudioManager; |
| 29 | 30 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 EventRouter* router = EventRouter::Get(browser_context_); | 84 EventRouter* router = EventRouter::Get(browser_context_); |
| 84 if (!router || !router->HasEventListener(kEventName)) | 85 if (!router || !router->HasEventListener(kEventName)) |
| 85 return; | 86 return; |
| 86 ExtensionService* extension_service = | 87 ExtensionService* extension_service = |
| 87 ExtensionSystem::Get(browser_context_)->extension_service(); | 88 ExtensionSystem::Get(browser_context_)->extension_service(); |
| 88 const ExtensionSet* extensions = extension_service->extensions(); | 89 const ExtensionSet* extensions = extension_service->extensions(); |
| 89 for (ExtensionSet::const_iterator it = extensions->begin(); | 90 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 90 it != extensions->end(); ++it) { | 91 it != extensions->end(); ++it) { |
| 91 const std::string& extension_id = (*it)->id(); | 92 const std::string& extension_id = (*it)->id(); |
| 92 if (router->ExtensionHasEventListener(extension_id, kEventName) && | 93 if (router->ExtensionHasEventListener(extension_id, kEventName) && |
| 93 (*it)->HasAPIPermission("webrtcAudioPrivate")) { | 94 (*it)->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) { |
| 94 scoped_ptr<Event> event( | 95 scoped_ptr<Event> event( |
| 95 new Event(kEventName, make_scoped_ptr(new base::ListValue()).Pass())); | 96 new Event(kEventName, make_scoped_ptr(new base::ListValue()).Pass())); |
| 96 router->DispatchEventToExtension(extension_id, event.Pass()); | 97 router->DispatchEventToExtension(extension_id, event.Pass()); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 | 101 |
| 101 WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() | 102 WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() |
| 102 : resource_context_(NULL) { | 103 : resource_context_(NULL) { |
| 103 } | 104 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); | 476 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); |
| 476 } else { | 477 } else { |
| 477 results_.reset( | 478 results_.reset( |
| 478 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); | 479 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); |
| 479 } | 480 } |
| 480 | 481 |
| 481 SendResponse(true); | 482 SendResponse(true); |
| 482 } | 483 } |
| 483 | 484 |
| 484 } // namespace extensions | 485 } // namespace extensions |
| OLD | NEW |