OLD | NEW |
---|---|
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_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "chrome/browser/extensions/event_router.h" | 8 #include "chrome/browser/extensions/event_router.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 | 10 |
11 ExtensionMediaPlayerEventRouter::ExtensionMediaPlayerEventRouter() | 11 ExtensionMediaPlayerEventRouter::ExtensionMediaPlayerEventRouter() |
12 : profile_(NULL) { | 12 : profile_(NULL) { |
13 } | 13 } |
14 | 14 |
15 ExtensionMediaPlayerEventRouter* | 15 ExtensionMediaPlayerEventRouter* |
16 ExtensionMediaPlayerEventRouter::GetInstance() { | 16 ExtensionMediaPlayerEventRouter::GetInstance() { |
17 return Singleton<ExtensionMediaPlayerEventRouter>::get(); | 17 return Singleton<ExtensionMediaPlayerEventRouter>::get(); |
18 } | 18 } |
19 | 19 |
20 void ExtensionMediaPlayerEventRouter::Init(Profile* profile) { | 20 void ExtensionMediaPlayerEventRouter::Init(Profile* profile) { |
21 profile_ = profile; | 21 profile_ = profile; |
22 } | 22 } |
23 | 23 |
24 void ExtensionMediaPlayerEventRouter::NotifyNextTrack() { | |
25 if (profile_ && profile_->GetExtensionEventRouter()) { | |
26 scoped_ptr<ListValue> args(new ListValue()); | |
27 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | |
28 "mediaPlayerPrivate.onNextTrack", args.Pass(), NULL, GURL()); | |
Daniel Erat
2012/08/21 20:38:42
nit: indent four spaces beyond previous line
sschmitz
2012/08/21 20:55:48
Done.
| |
29 } | |
30 } | |
31 | |
24 void ExtensionMediaPlayerEventRouter::NotifyPlaylistChanged() { | 32 void ExtensionMediaPlayerEventRouter::NotifyPlaylistChanged() { |
25 if (profile_ && profile_->GetExtensionEventRouter()) { | 33 if (profile_ && profile_->GetExtensionEventRouter()) { |
26 scoped_ptr<ListValue> args(new ListValue()); | 34 scoped_ptr<ListValue> args(new ListValue()); |
27 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 35 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
28 "mediaPlayerPrivate.onPlaylistChanged", args.Pass(), NULL, GURL()); | 36 "mediaPlayerPrivate.onPlaylistChanged", args.Pass(), NULL, GURL()); |
29 } | 37 } |
30 } | 38 } |
39 | |
40 void ExtensionMediaPlayerEventRouter::NotifyPrevTrack() { | |
41 if (profile_ && profile_->GetExtensionEventRouter()) { | |
42 scoped_ptr<ListValue> args(new ListValue()); | |
43 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | |
44 "mediaPlayerPrivate.onPrevTrack", args.Pass(), NULL, GURL()); | |
Daniel Erat
2012/08/21 20:38:42
ditto
sschmitz
2012/08/21 20:55:48
Done.
| |
45 } | |
46 } | |
47 | |
48 void ExtensionMediaPlayerEventRouter::NotifyTogglePlayState() { | |
49 if (profile_ && profile_->GetExtensionEventRouter()) { | |
50 scoped_ptr<ListValue> args(new ListValue()); | |
51 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | |
52 "mediaPlayerPrivate.onTogglePlayState", args.Pass(), NULL, GURL()); | |
Daniel Erat
2012/08/21 20:38:42
ditto
sschmitz
2012/08/21 20:55:48
Done.
| |
53 } | |
54 } | |
OLD | NEW |