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 "extensions/browser/api/audio/audio_api.h" | 5 #include "extensions/browser/api/audio/audio_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 bool CanReceiveDeprecatedAudioEvent(content::BrowserContext* context, | 41 bool CanReceiveDeprecatedAudioEvent(content::BrowserContext* context, |
42 const Extension* extension, | 42 const Extension* extension, |
43 Event* event, | 43 Event* event, |
44 const base::DictionaryValue* filter) { | 44 const base::DictionaryValue* filter) { |
45 return CanUseDeprecatedAudioApi(extension); | 45 return CanUseDeprecatedAudioApi(extension); |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 static base::LazyInstance<BrowserContextKeyedAPIFactory<AudioAPI> > g_factory = | 50 static base::LazyInstance< |
| 51 BrowserContextKeyedAPIFactory<AudioAPI>>::DestructorAtExit g_factory = |
51 LAZY_INSTANCE_INITIALIZER; | 52 LAZY_INSTANCE_INITIALIZER; |
52 | 53 |
53 // static | 54 // static |
54 BrowserContextKeyedAPIFactory<AudioAPI>* AudioAPI::GetFactoryInstance() { | 55 BrowserContextKeyedAPIFactory<AudioAPI>* AudioAPI::GetFactoryInstance() { |
55 return g_factory.Pointer(); | 56 return g_factory.Pointer(); |
56 } | 57 } |
57 | 58 |
58 AudioAPI::AudioAPI(content::BrowserContext* context) | 59 AudioAPI::AudioAPI(content::BrowserContext* context) |
59 : browser_context_(context), service_(AudioService::CreateInstance()) { | 60 : browser_context_(context), service_(AudioService::CreateInstance()) { |
60 service_->AddObserver(this); | 61 service_->AddObserver(this); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 bool value = false; | 281 bool value = false; |
281 if (!service->GetMute(params->stream_type == audio::STREAM_TYPE_INPUT, | 282 if (!service->GetMute(params->stream_type == audio::STREAM_TYPE_INPUT, |
282 &value)) { | 283 &value)) { |
283 return RespondNow(Error("Could not get mute state.")); | 284 return RespondNow(Error("Could not get mute state.")); |
284 } | 285 } |
285 return RespondNow(ArgumentList(audio::GetMute::Results::Create(value))); | 286 return RespondNow(ArgumentList(audio::GetMute::Results::Create(value))); |
286 } | 287 } |
287 | 288 |
288 } // namespace extensions | 289 } // namespace extensions |
OLD | NEW |