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

Side by Side Diff: chrome/browser/chromeos/media/media_player.cc

Issue 7741021: Fixing: Media file doesn't play after closing the media player using ctrl + w (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (current_playlist_[x].url == url) { 160 if (current_playlist_[x].url == url) {
161 current_playlist_[x].haderror = true; 161 current_playlist_[x].haderror = true;
162 } 162 }
163 } 163 }
164 NotifyPlaylistChanged(); 164 NotifyPlaylistChanged();
165 } 165 }
166 166
167 void MediaPlayer::Observe(int type, 167 void MediaPlayer::Observe(int type,
168 const NotificationSource& source, 168 const NotificationSource& source,
169 const NotificationDetails& details) { 169 const NotificationDetails& details) {
170 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSING); 170 DCHECK(type == chrome::NOTIFICATION_BROWSER_CLOSED);
171 registrar_.Remove(this, 171 registrar_.Remove(this,
172 chrome::NOTIFICATION_BROWSER_CLOSING, 172 chrome::NOTIFICATION_BROWSER_CLOSED,
173 source); 173 source);
174 if (Source<Browser>(source).ptr() == mediaplayer_browser_) { 174 if (Source<Browser>(source).ptr() == mediaplayer_browser_) {
175 mediaplayer_browser_ = NULL; 175 mediaplayer_browser_ = NULL;
176 } else if (Source<Browser>(source).ptr() == playlist_browser_) { 176 } else if (Source<Browser>(source).ptr() == playlist_browser_) {
177 playlist_browser_ = NULL; 177 playlist_browser_ = NULL;
178 } 178 }
179 } 179 }
180 180
181 void MediaPlayer::NotifyPlaylistChanged() { 181 void MediaPlayer::NotifyPlaylistChanged() {
182 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPlaylistChanged(); 182 ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPlaylistChanged();
(...skipping 15 matching lines...) Expand all
198 } 198 }
199 } 199 }
200 200
201 void MediaPlayer::PopupPlaylist(Browser* creator) { 201 void MediaPlayer::PopupPlaylist(Browser* creator) {
202 Profile* profile = BrowserList::GetLastActive()->profile(); 202 Profile* profile = BrowserList::GetLastActive()->profile();
203 playlist_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL, 203 playlist_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL,
204 kMediaPlayerAppName, 204 kMediaPlayerAppName,
205 gfx::Rect(), 205 gfx::Rect(),
206 profile); 206 profile);
207 registrar_.Add(this, 207 registrar_.Add(this,
208 chrome::NOTIFICATION_BROWSER_CLOSING, 208 chrome::NOTIFICATION_BROWSER_CLOSED,
209 Source<Browser>(playlist_browser_)); 209 Source<Browser>(playlist_browser_));
210 playlist_browser_->AddSelectedTabWithURL(GetMediaplayerPlaylistUrl(), 210 playlist_browser_->AddSelectedTabWithURL(GetMediaplayerPlaylistUrl(),
211 PageTransition::LINK); 211 PageTransition::LINK);
212 playlist_browser_->window()->SetBounds(gfx::Rect(kPopupLeft, 212 playlist_browser_->window()->SetBounds(gfx::Rect(kPopupLeft,
213 kPopupTop, 213 kPopupTop,
214 kPopupWidth, 214 kPopupWidth,
215 kPopupHeight)); 215 kPopupHeight));
216 playlist_browser_->window()->Show(); 216 playlist_browser_->window()->Show();
217 } 217 }
218 218
219 void MediaPlayer::PopupMediaPlayer(Browser* creator) { 219 void MediaPlayer::PopupMediaPlayer(Browser* creator) {
220 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 220 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
221 BrowserThread::PostTask( 221 BrowserThread::PostTask(
222 BrowserThread::UI, FROM_HERE, 222 BrowserThread::UI, FROM_HERE,
223 NewRunnableMethod(this, &MediaPlayer::PopupMediaPlayer, 223 NewRunnableMethod(this, &MediaPlayer::PopupMediaPlayer,
224 static_cast<Browser*>(NULL))); 224 static_cast<Browser*>(NULL)));
225 return; 225 return;
226 } 226 }
227 Profile* profile = BrowserList::GetLastActive()->profile(); 227 Profile* profile = BrowserList::GetLastActive()->profile();
228 mediaplayer_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL, 228 mediaplayer_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL,
229 kMediaPlayerAppName, 229 kMediaPlayerAppName,
230 gfx::Rect(), 230 gfx::Rect(),
231 profile); 231 profile);
232 registrar_.Add(this, 232 registrar_.Add(this,
233 chrome::NOTIFICATION_BROWSER_CLOSING, 233 chrome::NOTIFICATION_BROWSER_CLOSED,
234 Source<Browser>(mediaplayer_browser_)); 234 Source<Browser>(mediaplayer_browser_));
235 235
236 #if defined(OS_CHROMEOS) 236 #if defined(OS_CHROMEOS)
237 // Since we are on chromeos, popups should be a PanelBrowserView, 237 // Since we are on chromeos, popups should be a PanelBrowserView,
238 // so we can just cast it. 238 // so we can just cast it.
239 if (creator) { 239 if (creator) {
240 chromeos::PanelBrowserView* creatorview = 240 chromeos::PanelBrowserView* creatorview =
241 static_cast<chromeos::PanelBrowserView*>(creator->window()); 241 static_cast<chromeos::PanelBrowserView*>(creator->window());
242 chromeos::PanelBrowserView* view = 242 chromeos::PanelBrowserView* view =
243 static_cast<chromeos::PanelBrowserView*>( 243 static_cast<chromeos::PanelBrowserView*>(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 MediaPlayer::MediaPlayer() 305 MediaPlayer::MediaPlayer()
306 : current_position_(0), 306 : current_position_(0),
307 pending_playback_request_(false), 307 pending_playback_request_(false),
308 playlist_browser_(NULL), 308 playlist_browser_(NULL),
309 mediaplayer_browser_(NULL) { 309 mediaplayer_browser_(NULL) {
310 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { 310 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) {
311 supported_mime_types_.insert(supported_mime_type_list[i]); 311 supported_mime_types_.insert(supported_mime_type_list[i]);
312 } 312 }
313 }; 313 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698