Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/chromeos/extensions/media_player_api.cc

Issue 11638024: Make MediaPlayerEventRouter a PKS to decouple it from ExtensionService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch rebased Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/chromeos/extensions/media_player_api.h"
6
7 #include "base/lazy_instance.h"
5 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
6 #include "chrome/browser/chromeos/media/media_player.h" 10 #include "chrome/browser/chromeos/media/media_player.h"
7 #include "chrome/browser/chromeos/media/media_player_extension_api.h" 11
12 namespace {
8 13
9 static const char kPropertyItems[] = "items"; 14 static const char kPropertyItems[] = "items";
10 static const char kPropertyPosition[] = "position"; 15 static const char kPropertyPosition[] = "position";
11 16
17 } // namespace
18
19 namespace extensions {
20
12 bool PlayMediaplayerFunction::RunImpl() { 21 bool PlayMediaplayerFunction::RunImpl() {
13 if (args_->GetSize() < 2) { 22 if (args_->GetSize() < 2) {
14 return false; 23 return false;
15 } 24 }
16 25
17 ListValue* url_list = NULL; 26 ListValue* url_list = NULL;
18 if (!args_->GetList(0, &url_list)) 27 if (!args_->GetList(0, &url_list))
19 return false; 28 return false;
20 29
21 int position; 30 int position;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (!args_->GetInteger(0, &height_diff)) 78 if (!args_->GetInteger(0, &height_diff))
70 return false; 79 return false;
71 MediaPlayer::GetInstance()->AdjustWindowHeight(height_diff); 80 MediaPlayer::GetInstance()->AdjustWindowHeight(height_diff);
72 return true; 81 return true;
73 } 82 }
74 83
75 bool CloseWindowMediaplayerFunction::RunImpl() { 84 bool CloseWindowMediaplayerFunction::RunImpl() {
76 MediaPlayer::GetInstance()->CloseWindow(); 85 MediaPlayer::GetInstance()->CloseWindow();
77 return true; 86 return true;
78 } 87 }
88
89 MediaPlayerAPI::MediaPlayerAPI(Profile* profile)
90 : profile_(profile) {
91 }
92
93 MediaPlayerAPI::~MediaPlayerAPI() {
94 }
95
96 // static
97 MediaPlayerAPI* MediaPlayerAPI::Get(Profile* profile) {
98 return ProfileKeyedAPIFactory<MediaPlayerAPI>::GetForProfile(profile);
99 }
100
101 MediaPlayerEventRouter* MediaPlayerAPI::media_player_event_router() {
102 if (!media_player_event_router_)
103 media_player_event_router_.reset(new MediaPlayerEventRouter(profile_));
104 return media_player_event_router_.get();
105 }
106
107 static base::LazyInstance<ProfileKeyedAPIFactory<MediaPlayerAPI> >
108 g_factory = LAZY_INSTANCE_INITIALIZER;
109
110 // static
111 ProfileKeyedAPIFactory<MediaPlayerAPI>* MediaPlayerAPI::GetFactoryInstance() {
112 return &g_factory.Get();
113 }
114
115 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/media_player_api.h ('k') | chrome/browser/chromeos/extensions/media_player_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698