OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/audio/audio_api.h" | 5 #include "chrome/browser/extensions/api/audio/audio_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/event_names.h" | 9 #include "chrome/browser/extensions/event_names.h" |
10 #include "chrome/browser/extensions/event_router.h" | 10 #include "chrome/browser/extensions/event_router.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 delete service_; | 31 delete service_; |
32 service_ = NULL; | 32 service_ = NULL; |
33 } | 33 } |
34 | 34 |
35 AudioService* AudioAPI::GetService() const { | 35 AudioService* AudioAPI::GetService() const { |
36 return service_; | 36 return service_; |
37 } | 37 } |
38 | 38 |
39 void AudioAPI::OnDeviceChanged() { | 39 void AudioAPI::OnDeviceChanged() { |
40 if (profile_ && ExtensionSystem::Get(profile_)->event_router()) { | 40 if (profile_ && ExtensionSystem::Get(profile_)->event_router()) { |
41 scoped_ptr<Event> event(new Event(event_names::kOnAudioDeviceChanged, | 41 scoped_ptr<Event> event(new Event( |
42 scoped_ptr<ListValue>(new ListValue()))); | 42 event_names::kOnAudioDeviceChanged, |
| 43 scoped_ptr<base::ListValue>(new base::ListValue()))); |
43 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( | 44 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( |
44 event.Pass()); | 45 event.Pass()); |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 bool AudioGetInfoFunction::RunImpl() { | 49 bool AudioGetInfoFunction::RunImpl() { |
49 AudioService* service = | 50 AudioService* service = |
50 AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService(); | 51 AudioAPI::GetFactoryInstance()->GetForProfile(profile())->GetService(); |
51 DCHECK(service); | 52 DCHECK(service); |
52 service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted, | 53 service->StartGetInfo(base::Bind(&AudioGetInfoFunction::OnGetInfoCompleted, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!service->SetDeviceProperties(params->id, | 96 if (!service->SetDeviceProperties(params->id, |
96 params->properties.is_muted, | 97 params->properties.is_muted, |
97 volume_value, | 98 volume_value, |
98 gain_value)) | 99 gain_value)) |
99 return false; | 100 return false; |
100 else | 101 else |
101 return true; | 102 return true; |
102 } | 103 } |
103 | 104 |
104 } // namespace extensions | 105 } // namespace extensions |
OLD | NEW |