| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 EventRouter* router = EventRouter::Get(browser_context_); | 90 EventRouter* router = EventRouter::Get(browser_context_); |
| 91 if (!router || !router->HasEventListener(kEventName)) | 91 if (!router || !router->HasEventListener(kEventName)) |
| 92 return; | 92 return; |
| 93 | 93 |
| 94 for (const scoped_refptr<const extensions::Extension>& extension : | 94 for (const scoped_refptr<const extensions::Extension>& extension : |
| 95 ExtensionRegistry::Get(browser_context_)->enabled_extensions()) { | 95 ExtensionRegistry::Get(browser_context_)->enabled_extensions()) { |
| 96 const std::string& extension_id = extension->id(); | 96 const std::string& extension_id = extension->id(); |
| 97 if (router->ExtensionHasEventListener(extension_id, kEventName) && | 97 if (router->ExtensionHasEventListener(extension_id, kEventName) && |
| 98 extension->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) { | 98 extension->permissions_data()->HasAPIPermission("webrtcAudioPrivate")) { |
| 99 std::unique_ptr<Event> event( | 99 std::unique_ptr<Event> event = base::MakeUnique<Event>( |
| 100 new Event(events::WEBRTC_AUDIO_PRIVATE_ON_SINKS_CHANGED, kEventName, | 100 events::WEBRTC_AUDIO_PRIVATE_ON_SINKS_CHANGED, kEventName, |
| 101 base::WrapUnique(new base::ListValue()))); | 101 base::MakeUnique<base::ListValue>()); |
| 102 router->DispatchEventToExtension(extension_id, std::move(event)); | 102 router->DispatchEventToExtension(extension_id, std::move(event)); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() {} | 107 WebrtcAudioPrivateFunction::WebrtcAudioPrivateFunction() {} |
| 108 | 108 |
| 109 WebrtcAudioPrivateFunction::~WebrtcAudioPrivateFunction() { | 109 WebrtcAudioPrivateFunction::~WebrtcAudioPrivateFunction() { |
| 110 } | 110 } |
| 111 | 111 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); | 497 results_.reset(wap::GetAssociatedSink::Results::Create("").release()); |
| 498 } else { | 498 } else { |
| 499 results_.reset( | 499 results_.reset( |
| 500 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); | 500 wap::GetAssociatedSink::Results::Create(associated_sink_id).release()); |
| 501 } | 501 } |
| 502 | 502 |
| 503 SendResponse(true); | 503 SendResponse(true); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace extensions | 506 } // namespace extensions |
| OLD | NEW |