diff options
author | dhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 00:00:50 +0000 |
---|---|---|
committer | dhg@chromium.org <dhg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 00:00:50 +0000 |
commit | 1ce78d4ea96c1b980d26e60cd19f756ca6765e01 (patch) | |
tree | d7b7f65e77ec0080a93e5b1bab1e80a6e50fdee5 /chrome | |
parent | e64acae98b10447395df572775c807b985d972a8 (diff) | |
download | chromium_src-1ce78d4ea96c1b980d26e60cd19f756ca6765e01.zip chromium_src-1ce78d4ea96c1b980d26e60cd19f756ca6765e01.tar.gz chromium_src-1ce78d4ea96c1b980d26e60cd19f756ca6765e01.tar.bz2 |
adding fullscreen support to the mediaplayer.
Tested by loading on device and clicking fullscreen button. (needs most recent codebase)
Review URL: http://codereview.chromium.org/1034002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42408 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/theme/mediaplayer_full_screen.png | bin | 0 -> 1458 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 1 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_ui.cc | 14 | ||||
-rw-r--r-- | chrome/browser/dom_ui/mediaplayer_ui.h | 1 | ||||
-rw-r--r-- | chrome/browser/resources/mediaplayer.html | 42 |
5 files changed, 54 insertions, 4 deletions
diff --git a/chrome/app/theme/mediaplayer_full_screen.png b/chrome/app/theme/mediaplayer_full_screen.png Binary files differnew file mode 100644 index 0000000..4776bff --- /dev/null +++ b/chrome/app/theme/mediaplayer_full_screen.png diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 75f0374..9f2482d 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -463,6 +463,7 @@ <include name="IDR_MEDIAPLAYER_PREV" file="mediaplayer_prev.png" type="BINDATA" /> <include name="IDR_MEDIAPLAYER_MENU" file="mediaplayer_menu.png" type="BINDATA" /> <include name="IDR_MEDIAPLAYER_VOL_HIGH" file="mediaplayer_vol_high.png" type="BINDATA" /> + <include name="IDR_MEDIAPLAYER_FULL_SCREEN" file="mediaplayer_full_screen.png" type="BINDATA" /> <include name="IDR_LOGIN_DEFAULT_USER" file="login_default.png" type="BINDATA" /> <include name="IDR_LOGIN_OTHER_USER" file="login_other.png" type="BINDATA" /> </if> diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc index 0633af5..f561603 100644 --- a/chrome/browser/dom_ui/mediaplayer_ui.cc +++ b/chrome/browser/dom_ui/mediaplayer_ui.cc @@ -104,6 +104,8 @@ class MediaplayerHandler : public DOMMessageHandler, void HandleTogglePlaylist(const Value* value); void HandleSetCurrentPlaylistOffset(const Value* value); + void HandleToggleFullscreen(const Value* value); + const std::vector<GURL>& GetCurrentPlaylist(); @@ -214,6 +216,8 @@ void MediaplayerHandler::RegisterMessages() { NewCallback(this, &MediaplayerHandler::HandleTogglePlaylist)); dom_ui_->RegisterMessageCallback("setCurrentPlaylistOffset", NewCallback(this, &MediaplayerHandler::HandleSetCurrentPlaylistOffset)); + dom_ui_->RegisterMessageCallback("toggleFullscreen", + NewCallback(this, &MediaplayerHandler::HandleToggleFullscreen)); } void MediaplayerHandler::GetPlaylistValue(ListValue& value) { @@ -246,6 +250,10 @@ int MediaplayerHandler::GetCurrentPlaylistOffset() { return currentOffset_; } +void MediaplayerHandler::HandleToggleFullscreen(const Value* value) { + MediaPlayer::Get()->ToggleFullscreen(); +} + void MediaplayerHandler::HandleSetCurrentPlaylistOffset(const Value* value) { ListValue results_value; DictionaryValue info_value; @@ -465,6 +473,12 @@ void MediaPlayer::NotifyPlaylistChanged() { } } +void MediaPlayer::ToggleFullscreen() { + if (handler_ && mediaplayer_browser_) { + mediaplayer_browser_->ToggleFullscreenMode(); + } +} + void MediaPlayer::RemoveHandler(MediaplayerHandler* handler) { if (handler == handler_) { handler_ = NULL; diff --git a/chrome/browser/dom_ui/mediaplayer_ui.h b/chrome/browser/dom_ui/mediaplayer_ui.h index 31ee1d2..58aac17 100644 --- a/chrome/browser/dom_ui/mediaplayer_ui.h +++ b/chrome/browser/dom_ui/mediaplayer_ui.h @@ -32,6 +32,7 @@ class MediaPlayer : public NotificationObserver, void ForcePlayMediaURL(const GURL& url); void TogglePlaylistWindowVisible(); void ShowPlaylistWindow(); + void ToggleFullscreen(); void ClosePlaylistWindow(); void SetPlaylistOffset(int offset); void RegisterNewHandler(MediaplayerHandler* handler, diff --git a/chrome/browser/resources/mediaplayer.html b/chrome/browser/resources/mediaplayer.html index d03c138..e6f7f09 100644 --- a/chrome/browser/resources/mediaplayer.html +++ b/chrome/browser/resources/mediaplayer.html @@ -8,7 +8,7 @@ -webkit-appearance: slider-horizontal; position: absolute; left: 93px; - right:90px; + right:120px; bottom:-2px; height: 30px; } @@ -22,7 +22,7 @@ body { -webkit-appearance: slider-horizontal; position: absolute; left: 93px; - right:90px; + right:120px; bottom:-2px; height: 30px; } @@ -100,6 +100,7 @@ body { height: 80px; width: 30px; right: 30px; + z-index: 99999; background: black; background: -webkit-gradient(linear, left top, @@ -114,6 +115,7 @@ body { height: 80px; width: 30px; right: 30px; + z-index: 99999; background: black; background: -webkit-gradient(linear, left top, @@ -122,6 +124,32 @@ body { to(#070707)); } +.audio.fullscreen { + position:absolute; + right: 60px; + cursor: pointer; + bottom:0; + z-index: 9999; + width: 30px; + background: url('../../app/theme/mediaplayer_full_screen.png'); + background-repeat: no-repeat; + background-position: 4px 4px; + height: 30px; +} + +.video.fullscreen { + position:absolute; + right: 60px; + cursor: pointer; + bottom:0; + z-index: 9999; + width: 30px; + background: url('../../app/theme/mediaplayer_full_screen.png'); + background-repeat: no-repeat; + background-position: 4px 4px; + height: 30px; +} + .volumeslider { -webkit-appearance: slider-vertical; position: absolute; @@ -191,7 +219,7 @@ body { } .duration { - right: 58px; + right: 88px; color: white; position: absolute; top: 7px; @@ -467,6 +495,12 @@ function setupPlaybackControls() { soundbutton.onclick = toggleVolumeVisible; element.appendChild(soundbutton); + var fullscreen = document.createElement('div'); + fullscreen.id = 'fullscreen'; + fullscreen.className = controlsclass + ' fullscreen'; + fullscreen.onclick = toggleFullscreen; + element.appendChild(fullscreen); + var volume = document.createElement('div'); volume.id = 'volume'; volume.className = controlsclass + ' volume'; @@ -509,7 +543,7 @@ function playAudioFile(uri) { }; function toggleFullscreen() { - + chrome.send('toggleFullscreen', ['']); }; function onMetadataAvail() { |