| 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 Profile* profile = dom_ui->GetProfile(); | 212 BrowserThread::PostTask( |
| 213 profile->GetChromeURLDataManager()->AddDataSource( | 213 BrowserThread::IO, FROM_HERE, |
| 214 new WebUIFavIconSource(profile)); | 214 NewRunnableMethod( |
| 215 ChromeURLDataManager::GetInstance(), |
| 216 &ChromeURLDataManager::AddDataSource, |
| 217 make_scoped_refptr(new WebUIFavIconSource(dom_ui->GetProfile())))); |
| 215 | 218 |
| 216 return WebUIMessageHandler::Attach(dom_ui); | 219 return WebUIMessageHandler::Attach(dom_ui); |
| 217 } | 220 } |
| 218 | 221 |
| 219 void MediaplayerHandler::Init(bool is_playlist, TabContents* contents) { | 222 void MediaplayerHandler::Init(bool is_playlist, TabContents* contents) { |
| 220 MediaPlayer* player = MediaPlayer::GetInstance(); | 223 MediaPlayer* player = MediaPlayer::GetInstance(); |
| 221 if (!is_playlist) { | 224 if (!is_playlist) { |
| 222 player->SetNewHandler(this, contents); | 225 player->SetNewHandler(this, contents); |
| 223 } else { | 226 } else { |
| 224 player->RegisterNewPlaylistHandler(this, contents); | 227 player->RegisterNewPlaylistHandler(this, contents); |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 if (is_playlist) { | 605 if (is_playlist) { |
| 603 handler->Init(true, contents); | 606 handler->Init(true, contents); |
| 604 } else { | 607 } else { |
| 605 handler->Init(false, contents); | 608 handler->Init(false, contents); |
| 606 } | 609 } |
| 607 | 610 |
| 608 MediaplayerUIHTMLSource* html_source = | 611 MediaplayerUIHTMLSource* html_source = |
| 609 new MediaplayerUIHTMLSource(is_playlist); | 612 new MediaplayerUIHTMLSource(is_playlist); |
| 610 | 613 |
| 611 // Set up the chrome://mediaplayer/ source. | 614 // Set up the chrome://mediaplayer/ source. |
| 612 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 615 BrowserThread::PostTask( |
| 616 BrowserThread::IO, FROM_HERE, |
| 617 NewRunnableMethod( |
| 618 ChromeURLDataManager::GetInstance(), |
| 619 &ChromeURLDataManager::AddDataSource, |
| 620 make_scoped_refptr(html_source))); |
| 613 } | 621 } |
| OLD | NEW |