OLD | NEW |
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/dom_ui/mediaplayer_ui.h" | 5 #include "chrome/browser/dom_ui/mediaplayer_ui.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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 MediaplayerHandler::MediaplayerHandler(bool is_playlist) | 202 MediaplayerHandler::MediaplayerHandler(bool is_playlist) |
203 : current_offset_(0), | 203 : current_offset_(0), |
204 is_playlist_(is_playlist) { | 204 is_playlist_(is_playlist) { |
205 } | 205 } |
206 | 206 |
207 MediaplayerHandler::~MediaplayerHandler() { | 207 MediaplayerHandler::~MediaplayerHandler() { |
208 } | 208 } |
209 | 209 |
210 WebUIMessageHandler* MediaplayerHandler::Attach(DOMUI* dom_ui) { | 210 WebUIMessageHandler* MediaplayerHandler::Attach(DOMUI* dom_ui) { |
211 // Create our favicon data source. | 211 // Create our favicon data source. |
212 BrowserThread::PostTask( | 212 Profile* profile = dom_ui->GetProfile(); |
213 BrowserThread::IO, FROM_HERE, | 213 profile->GetChromeURLDataManager()->AddDataSource( |
214 NewRunnableMethod( | 214 new WebUIFavIconSource(profile)); |
215 ChromeURLDataManager::GetInstance(), | |
216 &ChromeURLDataManager::AddDataSource, | |
217 make_scoped_refptr(new WebUIFavIconSource(dom_ui->GetProfile())))); | |
218 | 215 |
219 return WebUIMessageHandler::Attach(dom_ui); | 216 return WebUIMessageHandler::Attach(dom_ui); |
220 } | 217 } |
221 | 218 |
222 void MediaplayerHandler::Init(bool is_playlist, TabContents* contents) { | 219 void MediaplayerHandler::Init(bool is_playlist, TabContents* contents) { |
223 MediaPlayer* player = MediaPlayer::GetInstance(); | 220 MediaPlayer* player = MediaPlayer::GetInstance(); |
224 if (!is_playlist) { | 221 if (!is_playlist) { |
225 player->SetNewHandler(this, contents); | 222 player->SetNewHandler(this, contents); |
226 } else { | 223 } else { |
227 player->RegisterNewPlaylistHandler(this, contents); | 224 player->RegisterNewPlaylistHandler(this, contents); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 if (is_playlist) { | 602 if (is_playlist) { |
606 handler->Init(true, contents); | 603 handler->Init(true, contents); |
607 } else { | 604 } else { |
608 handler->Init(false, contents); | 605 handler->Init(false, contents); |
609 } | 606 } |
610 | 607 |
611 MediaplayerUIHTMLSource* html_source = | 608 MediaplayerUIHTMLSource* html_source = |
612 new MediaplayerUIHTMLSource(is_playlist); | 609 new MediaplayerUIHTMLSource(is_playlist); |
613 | 610 |
614 // Set up the chrome://mediaplayer/ source. | 611 // Set up the chrome://mediaplayer/ source. |
615 BrowserThread::PostTask( | 612 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
616 BrowserThread::IO, FROM_HERE, | |
617 NewRunnableMethod( | |
618 ChromeURLDataManager::GetInstance(), | |
619 &ChromeURLDataManager::AddDataSource, | |
620 make_scoped_refptr(html_source))); | |
621 } | 613 } |
OLD | NEW |