Index: extensions/browser/api/audio/audio_api.cc |
diff --git a/extensions/browser/api/audio/audio_api.cc b/extensions/browser/api/audio/audio_api.cc |
index 659ae6ce67637ac20228a53e47681c1ab558b37a..3bd7219067503c3a6443614a10f6cca1549530f5 100644 |
--- a/extensions/browser/api/audio/audio_api.cc |
+++ b/extensions/browser/api/audio/audio_api.cc |
@@ -45,6 +45,16 @@ void AudioAPI::OnDeviceChanged() { |
} |
} |
+void AudioAPI::OnOutputNodeVolumeChanged(const std::string& id, double volume) { |
+ if (browser_context_ && EventRouter::Get(browser_context_)) { |
+ scoped_ptr<base::ListValue> args = |
+ audio::OnOutputNodeVolumeChanged::Create(id, volume); |
+ scoped_ptr<Event> event( |
+ new Event(audio::OnOutputNodeVolumeChanged::kEventName, args.Pass())); |
+ EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); |
+ } |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
bool AudioGetInfoFunction::RunAsync() { |
@@ -107,4 +117,27 @@ bool AudioSetPropertiesFunction::RunSync() { |
return true; |
} |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
+bool AudioGetDeviceInfoFunction::RunAsync() { |
+ AudioService* service = |
+ AudioAPI::GetFactoryInstance()->Get(browser_context())->GetService(); |
+ DCHECK(service); |
+ service->StartGetDeviceInfo( |
+ base::Bind(&AudioGetDeviceInfoFunction::OnGetDeviceInfoCompleted, this)); |
+ return true; |
+} |
+ |
+void AudioGetDeviceInfoFunction::OnGetDeviceInfoCompleted( |
+ const DevicesInfo& devices_info, |
+ bool success) { |
+ if (success) |
+ results_ = audio::GetDeviceInfo::Results::Create(devices_info); |
+ else |
+ SetError("Error occurred when querying audio device information."); |
+ SendResponse(success); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+ |
} // namespace extensions |