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

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

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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 | Annotate | Revision Log
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_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/extensions/extension_system.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 11
11 ExtensionMediaPlayerEventRouter::ExtensionMediaPlayerEventRouter() 12 ExtensionMediaPlayerEventRouter::ExtensionMediaPlayerEventRouter()
12 : profile_(NULL) { 13 : profile_(NULL) {
13 } 14 }
14 15
15 ExtensionMediaPlayerEventRouter* 16 ExtensionMediaPlayerEventRouter*
16 ExtensionMediaPlayerEventRouter::GetInstance() { 17 ExtensionMediaPlayerEventRouter::GetInstance() {
17 return Singleton<ExtensionMediaPlayerEventRouter>::get(); 18 return Singleton<ExtensionMediaPlayerEventRouter>::get();
18 } 19 }
19 20
20 void ExtensionMediaPlayerEventRouter::Init(Profile* profile) { 21 void ExtensionMediaPlayerEventRouter::Init(Profile* profile) {
21 profile_ = profile; 22 profile_ = profile;
22 } 23 }
23 24
24 void ExtensionMediaPlayerEventRouter::NotifyNextTrack() { 25 void ExtensionMediaPlayerEventRouter::NotifyNextTrack() {
25 if (profile_ && profile_->GetExtensionEventRouter()) { 26 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
26 scoped_ptr<ListValue> args(new ListValue()); 27 scoped_ptr<ListValue> args(new ListValue());
27 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 28 extensions::ExtensionSystem::Get(profile_)->event_router()->
28 "mediaPlayerPrivate.onNextTrack", args.Pass(), NULL, GURL()); 29 DispatchEventToRenderers("mediaPlayerPrivate.onNextTrack", args.Pass(),
30 NULL, GURL());
29 } 31 }
30 } 32 }
31 33
32 void ExtensionMediaPlayerEventRouter::NotifyPlaylistChanged() { 34 void ExtensionMediaPlayerEventRouter::NotifyPlaylistChanged() {
33 if (profile_ && profile_->GetExtensionEventRouter()) { 35 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
34 scoped_ptr<ListValue> args(new ListValue()); 36 scoped_ptr<ListValue> args(new ListValue());
35 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 37 extensions::ExtensionSystem::Get(profile_)->event_router()->
36 "mediaPlayerPrivate.onPlaylistChanged", args.Pass(), NULL, GURL()); 38 DispatchEventToRenderers("mediaPlayerPrivate.onPlaylistChanged",
39 args.Pass(), NULL, GURL());
37 } 40 }
38 } 41 }
39 42
40 void ExtensionMediaPlayerEventRouter::NotifyPrevTrack() { 43 void ExtensionMediaPlayerEventRouter::NotifyPrevTrack() {
41 if (profile_ && profile_->GetExtensionEventRouter()) { 44 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
42 scoped_ptr<ListValue> args(new ListValue()); 45 scoped_ptr<ListValue> args(new ListValue());
43 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 46 extensions::ExtensionSystem::Get(profile_)->event_router()->
44 "mediaPlayerPrivate.onPrevTrack", args.Pass(), NULL, GURL()); 47 DispatchEventToRenderers("mediaPlayerPrivate.onPrevTrack", args.Pass(),
48 NULL, GURL());
45 } 49 }
46 } 50 }
47 51
48 void ExtensionMediaPlayerEventRouter::NotifyTogglePlayState() { 52 void ExtensionMediaPlayerEventRouter::NotifyTogglePlayState() {
49 if (profile_ && profile_->GetExtensionEventRouter()) { 53 if (profile_ && extensions::ExtensionSystem::Get(profile_)->event_router()) {
50 scoped_ptr<ListValue> args(new ListValue()); 54 scoped_ptr<ListValue> args(new ListValue());
51 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 55 extensions::ExtensionSystem::Get(profile_)->event_router()->
52 "mediaPlayerPrivate.onTogglePlayState", args.Pass(), NULL, GURL()); 56 DispatchEventToRenderers("mediaPlayerPrivate.onTogglePlayState",
57 args.Pass(), NULL, GURL());
53 } 58 }
54 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698