blob: a95ab27a1c462b39ac2b92ca7a935c015edd5bd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/extensions/media_player_event_router.h"
#include "base/memory/singleton.h"
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
#include "extensions/browser/event_router.h"
namespace extensions {
static void BroadcastEvent(Profile* profile, const std::string& event_name) {
if (profile && extensions::ExtensionSystem::Get(profile)->event_router()) {
scoped_ptr<ListValue> args(new ListValue());
scoped_ptr<extensions::Event> event(new extensions::Event(
event_name, args.Pass()));
extensions::ExtensionSystem::Get(profile)->event_router()->
BroadcastEvent(event.Pass());
}
}
MediaPlayerEventRouter::MediaPlayerEventRouter(Profile* profile)
: profile_(profile) {
}
MediaPlayerEventRouter::~MediaPlayerEventRouter() {
}
void MediaPlayerEventRouter::NotifyNextTrack() {
BroadcastEvent(profile_, "mediaPlayerPrivate.onNextTrack");
}
void MediaPlayerEventRouter::NotifyPrevTrack() {
BroadcastEvent(profile_, "mediaPlayerPrivate.onPrevTrack");
}
void MediaPlayerEventRouter::NotifyTogglePlayState() {
BroadcastEvent(profile_, "mediaPlayerPrivate.onTogglePlayState");
}
} // namespace extensions
|