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. 4 5 #include "chrome/browser/chromeos/extensions/media_player_api.h" 6 7 #include "base/lazy_instance.h" 8 #include "base/values.h" 9 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" 10 11 namespace extensions { 12 13 MediaPlayerAPI::MediaPlayerAPI(Profile* profile) : profile_(profile) { 14 } 15 16 MediaPlayerAPI::~MediaPlayerAPI() { 17 } 18 19 // static 20 MediaPlayerAPI* MediaPlayerAPI::Get(Profile* profile) { 21 return ProfileKeyedAPIFactory<MediaPlayerAPI>::GetForProfile(profile); 22 } 23 24 MediaPlayerEventRouter* MediaPlayerAPI::media_player_event_router() { 25 if (!media_player_event_router_) 26 media_player_event_router_.reset(new MediaPlayerEventRouter(profile_)); 27 return media_player_event_router_.get(); 28 } 29 30 static base::LazyInstance<ProfileKeyedAPIFactory<MediaPlayerAPI> > 31 g_factory = LAZY_INSTANCE_INITIALIZER; 32 33 // static 34 ProfileKeyedAPIFactory<MediaPlayerAPI>* MediaPlayerAPI::GetFactoryInstance() { 35 return &g_factory.Get(); 36 } 37 38 } // namespace extensions 39