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

Side by Side Diff: chrome/browser/chromeos/media/media_player.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/media/media_player.h" 5 #include "chrome/browser/chromeos/media/media_player.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 11 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
12 #include "chrome/browser/chromeos/extensions/media_player_api.h"
12 #include "chrome/browser/chromeos/extensions/media_player_event_router.h" 13 #include "chrome/browser/chromeos/extensions/media_player_event_router.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/browser_tabstrip.h" 18 #include "chrome/browser/ui/browser_tabstrip.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 EnqueueMediaFileUrl(url); 104 EnqueueMediaFileUrl(url);
104 SetPlaylistPosition(0); 105 SetPlaylistPosition(0);
105 NotifyPlaylistChanged(); 106 NotifyPlaylistChanged();
106 } 107 }
107 108
108 void MediaPlayer::SetPlaylistPosition(int position) { 109 void MediaPlayer::SetPlaylistPosition(int position) {
109 current_position_ = position; 110 current_position_ = position;
110 } 111 }
111 112
112 void MediaPlayer::NotifyPlaylistChanged() { 113 void MediaPlayer::NotifyPlaylistChanged() {
113 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPlaylistChanged(); 114 Browser* browser = GetBrowser();
115 if (browser) {
116 extensions::MediaPlayerAPI::Get(browser->profile())->
117 media_player_event_router()->NotifyPlaylistChanged();
118 }
114 } 119 }
115 120
116 void MediaPlayer::PopupMediaPlayer() { 121 void MediaPlayer::PopupMediaPlayer() {
117 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 122 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
118 BrowserThread::PostTask( 123 BrowserThread::PostTask(
119 BrowserThread::UI, FROM_HERE, 124 BrowserThread::UI, FROM_HERE,
120 base::Bind(&MediaPlayer::PopupMediaPlayer, 125 base::Bind(&MediaPlayer::PopupMediaPlayer,
121 base::Unretained(this) /*this class is a singleton*/)); 126 base::Unretained(this) /*this class is a singleton*/));
122 return; 127 return;
123 } 128 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (base_url == GetMediaPlayerUrl()) 163 if (base_url == GetMediaPlayerUrl())
159 return browser; 164 return browser;
160 } 165 }
161 } 166 }
162 return NULL; 167 return NULL;
163 } 168 }
164 169
165 MediaPlayer::MediaPlayer() 170 MediaPlayer::MediaPlayer()
166 : current_position_(0) { 171 : current_position_(0) {
167 }; 172 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698