| 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/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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 // static | 84 // static |
| 85 MediaPlayer* MediaPlayer::GetInstance() { | 85 MediaPlayer* MediaPlayer::GetInstance() { |
| 86 return Singleton<MediaPlayer>::get(); | 86 return Singleton<MediaPlayer>::get(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void MediaPlayer::EnqueueMediaFile(Profile* profile, | 89 void MediaPlayer::EnqueueMediaFile(Profile* profile, |
| 90 const FilePath& file_path) { | 90 const FilePath& file_path) { |
| 91 GURL url; | 91 GURL url; |
| 92 if (!FileManagerUtil::ConvertFileToFileSystemUrl(profile, file_path, | 92 if (!file_manager_util::ConvertFileToFileSystemUrl(profile, file_path, |
| 93 GetOriginUrl(), &url)) { | 93 GetOriginUrl(), &url)) { |
| 94 } | 94 } |
| 95 EnqueueMediaFileUrl(url); | 95 EnqueueMediaFileUrl(url); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void MediaPlayer::EnqueueMediaFileUrl(const GURL& url) { | 98 void MediaPlayer::EnqueueMediaFileUrl(const GURL& url) { |
| 99 current_playlist_.push_back(MediaUrl(url)); | 99 current_playlist_.push_back(MediaUrl(url)); |
| 100 NotifyPlaylistChanged(); | 100 NotifyPlaylistChanged(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void MediaPlayer::ForcePlayMediaFile(Profile* profile, | 103 void MediaPlayer::ForcePlayMediaFile(Profile* profile, |
| 104 const FilePath& file_path) { | 104 const FilePath& file_path) { |
| 105 GURL url; | 105 GURL url; |
| 106 if (!FileManagerUtil::ConvertFileToFileSystemUrl(profile, file_path, | 106 if (!file_manager_util::ConvertFileToFileSystemUrl(profile, file_path, |
| 107 GetOriginUrl(), &url)) { | 107 GetOriginUrl(), &url)) { |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 ForcePlayMediaURL(url); | 110 ForcePlayMediaURL(url); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void MediaPlayer::ForcePlayMediaURL(const GURL& url) { | 113 void MediaPlayer::ForcePlayMediaURL(const GURL& url) { |
| 114 current_playlist_.clear(); | 114 current_playlist_.clear(); |
| 115 current_playlist_.push_back(MediaUrl(url)); | 115 current_playlist_.push_back(MediaUrl(url)); |
| 116 current_position_ = current_playlist_.size() - 1; | 116 current_position_ = current_playlist_.size() - 1; |
| 117 pending_playback_request_ = true; | 117 pending_playback_request_ = true; |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 !request->referrer().empty()) { | 279 !request->referrer().empty()) { |
| 280 PopupMediaPlayer(NULL); | 280 PopupMediaPlayer(NULL); |
| 281 ForcePlayMediaURL(request->url()); | 281 ForcePlayMediaURL(request->url()); |
| 282 request->Cancel(); | 282 request->Cancel(); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 return NULL; | 285 return NULL; |
| 286 } | 286 } |
| 287 | 287 |
| 288 GURL MediaPlayer::GetOriginUrl() const { | 288 GURL MediaPlayer::GetOriginUrl() const { |
| 289 return FileManagerUtil::GetMediaPlayerUrl().GetOrigin(); | 289 return file_manager_util::GetMediaPlayerUrl().GetOrigin(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 GURL MediaPlayer::GetMediaplayerPlaylistUrl() const { | 292 GURL MediaPlayer::GetMediaplayerPlaylistUrl() const { |
| 293 return FileManagerUtil::GetMediaPlayerPlaylistUrl(); | 293 return file_manager_util::GetMediaPlayerPlaylistUrl(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 GURL MediaPlayer::GetMediaPlayerUrl() const { | 296 GURL MediaPlayer::GetMediaPlayerUrl() const { |
| 297 return FileManagerUtil::GetMediaPlayerUrl(); | 297 return file_manager_util::GetMediaPlayerUrl(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 MediaPlayer::MediaPlayer() | 300 MediaPlayer::MediaPlayer() |
| 301 : current_position_(0), | 301 : current_position_(0), |
| 302 pending_playback_request_(false), | 302 pending_playback_request_(false), |
| 303 playlist_browser_(NULL), | 303 playlist_browser_(NULL), |
| 304 mediaplayer_browser_(NULL) { | 304 mediaplayer_browser_(NULL) { |
| 305 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { | 305 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { |
| 306 supported_mime_types_.insert(supported_mime_type_list[i]); | 306 supported_mime_types_.insert(supported_mime_type_list[i]); |
| 307 } | 307 } |
| 308 }; | 308 }; |
| OLD | NEW |