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

Unified Diff: chrome/browser/chromeos/extensions/media_player_event_router.cc

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/media_player_event_router.cc
diff --git a/chrome/browser/chromeos/extensions/media_player_event_router.cc b/chrome/browser/chromeos/extensions/media_player_event_router.cc
index b5eb05d6c73334c17cf6aa6f6ba1d2860cf77567..667a02bed9a5f33c014c1d6ddcb6efdcfe6f2df0 100644
--- a/chrome/browser/chromeos/extensions/media_player_event_router.cc
+++ b/chrome/browser/chromeos/extensions/media_player_event_router.cc
@@ -9,6 +9,16 @@
#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
+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());
+ }
+}
+
ExtensionMediaPlayerEventRouter::ExtensionMediaPlayerEventRouter()
: profile_(NULL) {
}
@@ -23,37 +33,17 @@ void ExtensionMediaPlayerEventRouter::Init(Profile* profile) {
}
void ExtensionMediaPlayerEventRouter::NotifyNextTrack() {
- if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
- scoped_ptr<ListValue> args(new ListValue());
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToRenderers("mediaPlayerPrivate.onNextTrack", args.Pass(),
- NULL, GURL());
- }
+ BroadcastEvent(profile_, "mediaPlayerPrivate.onNextTrack");
}
void ExtensionMediaPlayerEventRouter::NotifyPlaylistChanged() {
- if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
- scoped_ptr<ListValue> args(new ListValue());
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToRenderers("mediaPlayerPrivate.onPlaylistChanged",
- args.Pass(), NULL, GURL());
- }
+ BroadcastEvent(profile_, "mediaPlayerPrivate.onPlaylistChanged");
}
void ExtensionMediaPlayerEventRouter::NotifyPrevTrack() {
- if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
- scoped_ptr<ListValue> args(new ListValue());
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToRenderers("mediaPlayerPrivate.onPrevTrack", args.Pass(),
- NULL, GURL());
- }
+ BroadcastEvent(profile_, "mediaPlayerPrivate.onPrevTrack");
}
void ExtensionMediaPlayerEventRouter::NotifyTogglePlayState() {
- if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
- scoped_ptr<ListValue> args(new ListValue());
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToRenderers("mediaPlayerPrivate.onTogglePlayState",
- args.Pass(), NULL, GURL());
- }
+ BroadcastEvent(profile_, "mediaPlayerPrivate.onTogglePlayState");
}
« no previous file with comments | « chrome/browser/chromeos/extensions/input_method_event_router.cc ('k') | chrome/browser/extensions/api/alarms/alarm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698