1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/extensions/media_player_api.h"
7 #include "base/lazy_instance.h"
8 #include "base/values.h"
9 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
11 namespace extensions
{
13 MediaPlayerAPI::MediaPlayerAPI(content::BrowserContext
* context
)
14 : browser_context_(context
) {}
16 MediaPlayerAPI::~MediaPlayerAPI() {
20 MediaPlayerAPI
* MediaPlayerAPI::Get(content::BrowserContext
* context
) {
21 return BrowserContextKeyedAPIFactory
<MediaPlayerAPI
>::Get(context
);
24 MediaPlayerEventRouter
* MediaPlayerAPI::media_player_event_router() {
25 if (!media_player_event_router_
)
26 media_player_event_router_
.reset(
27 new MediaPlayerEventRouter(browser_context_
));
28 return media_player_event_router_
.get();
31 static base::LazyInstance
<BrowserContextKeyedAPIFactory
<MediaPlayerAPI
> >
32 g_factory
= LAZY_INSTANCE_INITIALIZER
;
35 BrowserContextKeyedAPIFactory
<MediaPlayerAPI
>*
36 MediaPlayerAPI::GetFactoryInstance() {
37 return g_factory
.Pointer();
40 } // namespace extensions