diff options
30 files changed, 529 insertions, 549 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index a2eddf8..a9c3fa7 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -10,11 +10,11 @@ #include "base/stl_util.h" #include "base/values.h" #include "chrome/browser/chromeos/extensions/file_browser_notifications.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/extensions/extension_event_names.h" #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/file_manager_util.h" #include "chrome/browser/profiles/profile.h" #include "grit/generated_resources.h" #include "webkit/fileapi/file_system_types.h" diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index e962491..53d4898 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/extension_file_browser_private_api.h" +#include "chrome/browser/chromeos/extensions/file_browser_private_api.h" #include "base/base64.h" #include "base/bind.h" @@ -15,13 +15,13 @@ #include "base/time.h" #include "base/values.h" #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" #include "chrome/browser/extensions/extension_event_router.h" #include "chrome/browser/extensions/extension_function_dispatcher.h" #include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_util.h" -#include "chrome/browser/extensions/file_manager_util.h" #include "chrome/browser/extensions/process_map.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" @@ -73,9 +73,6 @@ const char kVolumeDevicePathNotFound[] = "Device path not found"; const char kGDataMountPoint[] = "/special/gdata"; #endif -// Internal task ids. -const char kEnqueueTaskId[] = "enqueue"; - const int kReadOnlyFilePermissions = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | base::PLATFORM_FILE_EXCLUSIVE_READ | @@ -1190,9 +1187,7 @@ void ViewFilesFunction::GetLocalPathsResponseOnUIThread( for (FilePathList::const_iterator iter = files.begin(); iter != files.end(); ++iter) { - bool handled = file_manager_util::TryViewingFile(*iter, - // Start the first one, enqueue others. - internal_task_id == kEnqueueTaskId || iter != files.begin()); + bool handled = file_manager_util::TryViewingFile(*iter); // If there is no default browser-defined handler for viewing this type // of file, try to see if we have any extension installed for it instead. if (!handled && files.size() == 1) diff --git a/chrome/browser/extensions/extension_file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index 4d2df78..a5d463e 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ #pragma once #include <map> @@ -367,4 +367,4 @@ class FileDialogStringsFunction : public SyncExtensionFunction { DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings"); }; -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_PRIVATE_API_H_ diff --git a/chrome/browser/extensions/extension_file_browser_private_apitest.cc b/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc index 2a72cf6..2a72cf6 100644 --- a/chrome/browser/extensions/extension_file_browser_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc diff --git a/chrome/browser/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 5b96ac6..2f5cd29 100644 --- a/chrome/browser/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -1,7 +1,7 @@ // Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "base/bind.h" #include "base/json/json_writer.h" @@ -73,9 +73,9 @@ const char* kBrowserSupportedExtensions[] = { // List of file extension that can be handled with the media player. const char* kAVExtensions[] = { #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) - ".3gp", ".avi", ".mp3", ".mp4", ".m4v", ".mov", ".m4a", + ".mp3", ".m4a", #endif - ".flac", ".ogm", ".ogv", ".ogx", ".ogg", ".oga", ".wav", ".webm", + ".flac", ".ogm", ".ogg", ".oga", ".wav", /* TODO(zelidrag): Add unsupported ones as we enable them: ".mkv", ".divx", ".xvid", ".wmv", ".asf", ".mpeg", ".mpg", ".wma", ".aiff", @@ -354,7 +354,7 @@ void ViewFolder(const FilePath& dir) { } void ViewFile(const FilePath& full_path, bool enqueue) { - if (!TryViewingFile(full_path, enqueue)) { + if (!TryViewingFile(full_path)) { Browser* browser = BrowserList::GetLastActive(); if (!browser) return; @@ -368,7 +368,7 @@ void ViewFile(const FilePath& full_path, bool enqueue) { } } -bool TryViewingFile(const FilePath& full_path, bool enqueue) { +bool TryViewingFile(const FilePath& full_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // There is nothing we can do if the browser is not present. @@ -388,18 +388,8 @@ bool TryViewingFile(const FilePath& full_path, bool enqueue) { #if defined(OS_CHROMEOS) if (IsSupportedAVExtension(file_extension.data())) { MediaPlayer* mediaplayer = MediaPlayer::GetInstance(); - - if (mediaplayer->GetPlaylist().empty()) - enqueue = false; // Force to start playback if current playlist is - // empty. - - if (enqueue) { - mediaplayer->PopupPlaylist(browser); - mediaplayer->EnqueueMediaFile(browser->profile(), full_path); - } else { - mediaplayer->PopupMediaPlayer(browser); - mediaplayer->ForcePlayMediaFile(browser->profile(), full_path); - } + mediaplayer->PopupMediaPlayer(browser); + mediaplayer->ForcePlayMediaFile(browser->profile(), full_path); return true; } #endif // OS_CHROMEOS diff --git a/chrome/browser/extensions/file_manager_util.h b/chrome/browser/chromeos/extensions/file_manager_util.h index 4ca1fd6..689b0f2 100644 --- a/chrome/browser/extensions/file_manager_util.h +++ b/chrome/browser/chromeos/extensions/file_manager_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_EXTENSIONS_FILE_MANAGER_UTIL_H_ -#define CHROME_BROWSER_EXTENSIONS_FILE_MANAGER_UTIL_H_ +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ #pragma once #include <string> @@ -57,14 +57,15 @@ void ViewRemovableDrive(const FilePath& dir); void ViewFolder(const FilePath& dir); // Opens file in the browser. +// TODO(kaznacheev): remove the obsolete enqueue parameter. void ViewFile(const FilePath& full_path, bool enqueue); // Tries to open |file| directly in the browser. Returns false if the browser // can't directly handle this type of file. -bool TryViewingFile(const FilePath& file, bool enqueue); +bool TryViewingFile(const FilePath& file); void InstallCRX(Profile* profile, const FilePath& full_path); } // namespace file_manager_util -#endif // CHROME_BROWSER_EXTENSIONS_FILE_MANAGER_UTIL_H_ +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_UTIL_H_ diff --git a/chrome/browser/chromeos/media/media_player.cc b/chrome/browser/chromeos/media/media_player.cc index c84e6a0..b0569c6 100644 --- a/chrome/browser/chromeos/media/media_player.cc +++ b/chrome/browser/chromeos/media/media_player.cc @@ -19,9 +19,9 @@ #include "base/time.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/chromeos/extensions/media_player_event_router.h" #include "chrome/browser/download/download_util.h" -#include "chrome/browser/extensions/file_manager_util.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model.h" @@ -57,8 +57,17 @@ using content::UserMetricsAction; static const char* kMediaPlayerAppName = "mediaplayer"; static const int kPopupLeft = 0; static const int kPopupTop = 0; -static const int kPopupWidth = 350; -static const int kPopupHeight = 300; +static const int kPopupWidth = 280; + +// Set the initial height to the minimum possible height. Keep the constants +// in sync with chrome/browser/resources/file_manager/css/audio_player.css. +// SetWindowHeight will be called soon after the popup creation with the correct +// height which will cause a nice slide-up animation. +// TODO(kaznacheev): Remove kTitleHeight when MediaPlayer becomes chromeless. +static const int kTitleHeight = 24; +static const int kTrackHeight = 58; +static const int kControlsHeight = 35; +static const int kPopupHeight = kTitleHeight + kTrackHeight + kControlsHeight; const MediaPlayer::UrlVector& MediaPlayer::GetPlaylist() const { return current_playlist_; @@ -82,17 +91,27 @@ MediaPlayer* MediaPlayer::GetInstance() { return Singleton<MediaPlayer>::get(); } -void MediaPlayer::EnqueueMediaFile(Profile* profile, - const FilePath& file_path) { - GURL url; - file_manager_util::ConvertFileToFileSystemUrl(profile, file_path, - GetOriginUrl(), &url); - EnqueueMediaFileUrl(url); +void MediaPlayer::SetWindowHeight(int height) { + if (mediaplayer_browser_ != NULL) { + mediaplayer_browser_->window()->SetBounds(gfx::Rect(kPopupLeft, + kPopupTop, + kPopupWidth, + height + kTitleHeight)); + } +} + +void MediaPlayer::CloseWindow() { + if (mediaplayer_browser_ != NULL) { + mediaplayer_browser_->window()->Close(); + } +} + +void MediaPlayer::ClearPlaylist() { + current_playlist_.clear(); } void MediaPlayer::EnqueueMediaFileUrl(const GURL& url) { - current_playlist_.push_back(MediaUrl(url)); - NotifyPlaylistChanged(); + current_playlist_.push_back(url); } void MediaPlayer::ForcePlayMediaFile(Profile* profile, @@ -105,41 +124,14 @@ void MediaPlayer::ForcePlayMediaFile(Profile* profile, } void MediaPlayer::ForcePlayMediaURL(const GURL& url) { - current_playlist_.clear(); - current_playlist_.push_back(MediaUrl(url)); - current_position_ = current_playlist_.size() - 1; - pending_playback_request_ = true; + ClearPlaylist(); + EnqueueMediaFileUrl(url); + SetPlaylistPosition(0); NotifyPlaylistChanged(); } -void MediaPlayer::TogglePlaylistWindowVisible() { - if (playlist_browser_) - ClosePlaylistWindow(); - else - PopupPlaylist(NULL); -} - -void MediaPlayer::ClosePlaylistWindow() { - if (playlist_browser_ != NULL) - playlist_browser_->window()->Close(); -} - void MediaPlayer::SetPlaylistPosition(int position) { - const int playlist_size = current_playlist_.size(); - if (current_position_ < 0 || current_position_ > playlist_size) - position = current_playlist_.size(); - if (current_position_ != position) { - current_position_ = position; - NotifyPlaylistChanged(); - } -} - -void MediaPlayer::SetPlaybackError(GURL const& url) { - for (size_t x = 0; x < current_playlist_.size(); x++) { - if (current_playlist_[x].url == url) - current_playlist_[x].haderror = true; - } - NotifyPlaylistChanged(); + current_position_ = position; } void MediaPlayer::Observe(int type, @@ -150,50 +142,12 @@ void MediaPlayer::Observe(int type, if (content::Source<Browser>(source).ptr() == mediaplayer_browser_) mediaplayer_browser_ = NULL; - else if (content::Source<Browser>(source).ptr() == playlist_browser_) - playlist_browser_ = NULL; } void MediaPlayer::NotifyPlaylistChanged() { ExtensionMediaPlayerEventRouter::GetInstance()->NotifyPlaylistChanged(); } -bool MediaPlayer::GetPendingPlayRequestAndReset() { - bool result = pending_playback_request_; - pending_playback_request_ = false; - return result; -} - -void MediaPlayer::SetPlaybackRequest() { - pending_playback_request_ = true; -} - -void MediaPlayer::ToggleFullscreen() { - if (mediaplayer_browser_) - mediaplayer_browser_->ToggleFullscreenMode(); -} - -void MediaPlayer::PopupPlaylist(Browser* creator) { - if (playlist_browser_) - return; // Already opened. - - Profile* profile = BrowserList::GetLastActive()->profile(); - playlist_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL, - kMediaPlayerAppName, - gfx::Rect(), - profile); - registrar_.Add(this, - chrome::NOTIFICATION_BROWSER_CLOSED, - content::Source<Browser>(playlist_browser_)); - playlist_browser_->AddSelectedTabWithURL(GetMediaplayerPlaylistUrl(), - content::PAGE_TRANSITION_LINK); - playlist_browser_->window()->SetBounds(gfx::Rect(kPopupLeft, - kPopupTop, - kPopupWidth, - kPopupHeight)); - playlist_browser_->window()->Show(); -} - void MediaPlayer::PopupMediaPlayer(Browser* creator) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask( @@ -209,7 +163,10 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) { Profile* profile = BrowserList::GetLastActive()->profile(); mediaplayer_browser_ = Browser::CreateForApp(Browser::TYPE_PANEL, kMediaPlayerAppName, - gfx::Rect(), + gfx::Rect(kPopupLeft, + kPopupTop, + kPopupWidth, + kPopupHeight), profile); registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, @@ -229,10 +186,6 @@ void MediaPlayer::PopupMediaPlayer(Browser* creator) { #endif mediaplayer_browser_->AddSelectedTabWithURL(GetMediaPlayerUrl(), content::PAGE_TRANSITION_LINK); - mediaplayer_browser_->window()->SetBounds(gfx::Rect(kPopupLeft, - kPopupTop, - kPopupWidth, - kPopupHeight)); mediaplayer_browser_->window()->Show(); } @@ -242,11 +195,9 @@ net::URLRequestJob* MediaPlayer::MaybeIntercept(net::URLRequest* request) { return NULL; } -// This is the list of mime types currently supported by the Google -// Document Viewer. +// This is the list of mime types currently supported by the Media Player. static const char* const supported_mime_type_list[] = { "audio/mpeg", - "video/mp4", "audio/mp3" }; @@ -276,18 +227,12 @@ GURL MediaPlayer::GetOriginUrl() const { return file_manager_util::GetMediaPlayerUrl().GetOrigin(); } -GURL MediaPlayer::GetMediaplayerPlaylistUrl() const { - return file_manager_util::GetMediaPlayerPlaylistUrl(); -} - GURL MediaPlayer::GetMediaPlayerUrl() const { return file_manager_util::GetMediaPlayerUrl(); } MediaPlayer::MediaPlayer() : current_position_(0), - pending_playback_request_(false), - playlist_browser_(NULL), mediaplayer_browser_(NULL) { for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { supported_mime_types_.insert(supported_mime_type_list[i]); diff --git a/chrome/browser/chromeos/media/media_player.h b/chrome/browser/chromeos/media/media_player.h index 53e1fb8..95a6771 100644 --- a/chrome/browser/chromeos/media/media_player.h +++ b/chrome/browser/chromeos/media/media_player.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,13 +26,18 @@ class Profile; class MediaPlayer : public content::NotificationObserver, public net::URLRequest::Interceptor { public: - struct MediaUrl; - typedef std::vector<MediaUrl> UrlVector; + typedef std::vector<GURL> UrlVector; virtual ~MediaPlayer(); - // Enqueues this file into the current playlist. - void EnqueueMediaFile(Profile* profile, const FilePath& file_path); + // Sets the mediaplayer window height. + void SetWindowHeight(int height); + + // Forces the mediaplayer window to be closed. + void CloseWindow(); + + // Clears the current playlist. + void ClearPlaylist(); // Enqueues this fileschema url into the current playlist. void EnqueueMediaFileUrl(const GURL& url); @@ -44,23 +49,10 @@ class MediaPlayer : public content::NotificationObserver, // Clears out the current playlist, and start playback of the given url. void ForcePlayMediaURL(const GURL& url); - // Toggle the visibility of the playlist window. - void TogglePlaylistWindowVisible(); - // Popup the mediaplayer, this shows the browser, and sets up its // locations correctly. void PopupMediaPlayer(Browser* creator); - // Popup the playlist. Shows the browser, sets it up to point at - // chrome://mediaplayer#playlist - void PopupPlaylist(Browser* creator); - - // Toggle the mediaplayer between fullscreen and windowed. - void ToggleFullscreen(); - - // Force the playlist window to be closed. - void ClosePlaylistWindow(); - // Sets the currently playing element to the given positions. void SetPlaylistPosition(int position); @@ -70,20 +62,10 @@ class MediaPlayer : public content::NotificationObserver, // Returns current playlist position. int GetPlaylistPosition() const; - // Set flag that error occuires while playing the url. - void SetPlaybackError(GURL const& url); - // Notfies the mediaplayer that the playlist changed. This could be // called from the mediaplayer itself for example. void NotifyPlaylistChanged(); - // Retuen true if playback requested. Resets this flag. - bool GetPendingPlayRequestAndReset(); - - // Requests starting playback of the current playlist item when the - // mediaplayer get the playlist updated. - void SetPlaybackRequest(); - // Always returns NULL because we don't want to attempt a redirect // before seeing the detected mime type of the request. // Implementation of net::URLRequest::Interceptor. @@ -118,13 +100,8 @@ class MediaPlayer : public content::NotificationObserver, MediaPlayer(); GURL GetOriginUrl() const; - GURL GetMediaplayerPlaylistUrl() const; GURL GetMediaPlayerUrl() const; - // Browser containing the playlist. Used to force closes. This is created - // By the PopupPlaylist call, and is NULLed out when the window is closed. - Browser* playlist_browser_; - // Browser containing the Mediaplayer. Used to force closes. This is // created by the PopupMediaplayer call, and is NULLed out when the window // is closed. @@ -140,13 +117,4 @@ class MediaPlayer : public content::NotificationObserver, DISALLOW_COPY_AND_ASSIGN(MediaPlayer); }; -struct MediaPlayer::MediaUrl { - MediaUrl() {} - explicit MediaUrl(const GURL& newurl) - : url(newurl), - haderror(false) {} - GURL url; - bool haderror; -}; - #endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ diff --git a/chrome/browser/chromeos/media/media_player_browsertest.cc b/chrome/browser/chromeos/media/media_player_browsertest.cc index 32691c7c..0b461db 100644 --- a/chrome/browser/chromeos/media/media_player_browsertest.cc +++ b/chrome/browser/chromeos/media/media_player_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,10 +36,6 @@ class MediaPlayerBrowserTest : public InProcessBrowserTest { bool IsPlayerVisible() { return IsBrowserVisible(MediaPlayer::GetInstance()->mediaplayer_browser_); } - - bool IsPlaylistVisible() { - return IsBrowserVisible(MediaPlayer::GetInstance()->playlist_browser_); - } }; IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) { @@ -53,27 +49,7 @@ IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) { ASSERT_FALSE(IsPlayerVisible()); player->PopupMediaPlayer(NULL); - player->EnqueueMediaFileUrl(GetMusicTestURL()); + player->ForcePlayMediaURL(GetMusicTestURL()); ASSERT_TRUE(IsPlayerVisible()); } - -IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, PopupPlaylist) { - ASSERT_TRUE(test_server()->Start()); - // Doing this so we have a valid profile. - ui_test_utils::NavigateToURL(browser(), - GURL("chrome://downloads")); - - - MediaPlayer* player = MediaPlayer::GetInstance(); - - player->PopupMediaPlayer(NULL); - player->EnqueueMediaFileUrl(GetMusicTestURL()); - - EXPECT_FALSE(IsPlaylistVisible()); - - player->TogglePlaylistWindowVisible(); - - EXPECT_TRUE(IsPlaylistVisible()); -} - diff --git a/chrome/browser/chromeos/media/media_player_extension_api.cc b/chrome/browser/chromeos/media/media_player_extension_api.cc new file mode 100644 index 0000000..b0a88c4 --- /dev/null +++ b/chrome/browser/chromeos/media/media_player_extension_api.cc @@ -0,0 +1,76 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/values.h" +#include "chrome/browser/chromeos/media/media_player.h" +#include "chrome/browser/chromeos/media/media_player_extension_api.h" + +static const char kPropertyItems[] = "items"; +static const char kPropertyPosition[] = "position"; + +bool PlayMediaplayerFunction::RunImpl() { + if (args_->GetSize() < 2) { + return false; + } + + ListValue* url_list = NULL; + if (!args_->GetList(0, &url_list)) + return false; + + int position; + if (!args_->GetInteger(1, &position)) + return false; + + MediaPlayer* player = MediaPlayer::GetInstance(); + + player->PopupMediaPlayer(NULL); + player->ClearPlaylist(); + + size_t len = url_list->GetSize(); + for (size_t i = 0; i < len; ++i) { + std::string path; + url_list->GetString(i, &path); + player->EnqueueMediaFileUrl(GURL(path)); + } + + player->SetPlaylistPosition(position); + player->NotifyPlaylistChanged(); + + return true; +} + +static ListValue* GetPlaylistItems() { + ListValue* result = new ListValue(); + + MediaPlayer::UrlVector const& src = MediaPlayer::GetInstance()->GetPlaylist(); + + for (size_t i = 0; i < src.size(); i++) { + result->Append(Value::CreateStringValue(src[i].spec())); + } + return result; +} + +bool GetPlaylistMediaplayerFunction::RunImpl() { + DictionaryValue* result = new DictionaryValue(); + MediaPlayer* player = MediaPlayer::GetInstance(); + + result->Set(kPropertyItems, GetPlaylistItems()); + result->SetInteger(kPropertyPosition, player->GetPlaylistPosition()); + + result_.reset(result); + return true; +} + +bool SetWindowHeightMediaplayerFunction::RunImpl() { + int height; + if (!args_->GetInteger(0, &height)) + return false; + MediaPlayer::GetInstance()->SetWindowHeight(height); + return true; +} + +bool CloseWindowMediaplayerFunction::RunImpl() { + MediaPlayer::GetInstance()->CloseWindow(); + return true; +} diff --git a/chrome/browser/chromeos/media/media_player_extension_api.h b/chrome/browser/chromeos/media/media_player_extension_api.h new file mode 100644 index 0000000..640d517 --- /dev/null +++ b/chrome/browser/chromeos/media/media_player_extension_api.h @@ -0,0 +1,47 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ +#define CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ +#pragma once + +#include <map> +#include <string> +#include <vector> + +#include "chrome/browser/extensions/extension_function.h" + +// Implements the chrome.mediaPlayerPrivate.play method. +class PlayMediaplayerFunction : public SyncExtensionFunction { + protected: + // SyncExtensionFunction overrides. + virtual bool RunImpl() OVERRIDE; + DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.play"); +}; + +// Implements the chrome.mediaPlayerPrivate.getPlaylist method. +class GetPlaylistMediaplayerFunction : public SyncExtensionFunction { + protected: + // SyncExtensionFunction overrides. + virtual bool RunImpl() OVERRIDE; + DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.getPlaylist"); +}; + +// Implements the chrome.mediaPlayerPrivate.setWindowHeight method. +class SetWindowHeightMediaplayerFunction : public SyncExtensionFunction { + protected: + // SyncExtensionFunction overrides. + virtual bool RunImpl() OVERRIDE; + DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.setWindowHeight"); +}; + +// Implements the chrome.mediaPlayerPrivate.closeWindow method. +class CloseWindowMediaplayerFunction : public SyncExtensionFunction { + protected: + // SyncExtensionFunction overrides. + virtual bool RunImpl() OVERRIDE; + DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.closeWindow"); +}; + +#endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_EXTENSION_API_H_ diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index b13ab8f..e16c810 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -89,11 +89,11 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/extensions/api/terminal/terminal_private_api.h" -#include "chrome/browser/extensions/extension_file_browser_private_api.h" #include "chrome/browser/extensions/extension_info_private_api_chromeos.h" #include "chrome/browser/extensions/extension_input_ime_api.h" #include "chrome/browser/extensions/extension_input_method_api.h" -#include "chrome/browser/extensions/extension_mediaplayer_private_api.h" +#include "chrome/browser/chromeos/extensions/file_browser_private_api.h" +#include "chrome/browser/chromeos/media/media_player_extension_api.h" #endif using extensions::ExtensionAPI; @@ -412,11 +412,10 @@ void FactoryRegistry::ResetFunctions() { RegisterFunction<ViewFilesFunction>(); // Mediaplayer - RegisterFunction<PlayAtMediaplayerFunction>(); - RegisterFunction<SetPlaybackErrorMediaplayerFunction>(); + RegisterFunction<PlayMediaplayerFunction>(); RegisterFunction<GetPlaylistMediaplayerFunction>(); - RegisterFunction<TogglePlaylistPanelMediaplayerFunction>(); - RegisterFunction<ToggleFullscreenMediaplayerFunction>(); + RegisterFunction<SetWindowHeightMediaplayerFunction>(); + RegisterFunction<CloseWindowMediaplayerFunction>(); // InputMethod RegisterFunction<GetInputMethodFunction>(); diff --git a/chrome/browser/extensions/extension_mediaplayer_private_api.cc b/chrome/browser/extensions/extension_mediaplayer_private_api.cc deleted file mode 100644 index 4fdee72..0000000 --- a/chrome/browser/extensions/extension_mediaplayer_private_api.cc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/extensions/extension_mediaplayer_private_api.h" - -#include "base/values.h" -#include "chrome/browser/chromeos/media/media_player.h" - -static const char kPropertyPath[] = "path"; -static const char kPropertyForce[] = "force"; -static const char kPropertyItems[] = "items"; -static const char kPropertyPosition[] = "position"; -static const char kPropertyError[] = "error"; -static const char kPropertyPendingPlaybackRequest[] = - "pendingPlaybackRequest"; - -bool PlayAtMediaplayerFunction::RunImpl() { - int position; - if (!args_->GetInteger(0, &position)) - return false; - MediaPlayer::GetInstance()->SetPlaybackRequest(); - MediaPlayer::GetInstance()->SetPlaylistPosition(position); - return true; -} - -static ListValue* GetPlaylistItems() { - ListValue* result = new ListValue(); - - MediaPlayer::UrlVector const& src = MediaPlayer::GetInstance()->GetPlaylist(); - - for (size_t i = 0; i < src.size(); i++) { - DictionaryValue* url_value = new DictionaryValue(); - url_value->SetString(kPropertyPath, src[i].url.spec()); - url_value->SetBoolean(kPropertyError, src[i].haderror); - result->Append(url_value); - } - return result; -} - -bool GetPlaylistMediaplayerFunction::RunImpl() { - bool reset_pending_playback_request; - if (!args_->GetBoolean(0, &reset_pending_playback_request)) - return false; - - DictionaryValue* result = new DictionaryValue(); - MediaPlayer* player = MediaPlayer::GetInstance(); - - result->Set(kPropertyItems, GetPlaylistItems()); - result->SetInteger(kPropertyPosition, player->GetPlaylistPosition()); - if (reset_pending_playback_request) { - result->SetBoolean(kPropertyPendingPlaybackRequest, - player->GetPendingPlayRequestAndReset()); - } - - result_.reset(result); - return true; -} - -bool SetPlaybackErrorMediaplayerFunction::RunImpl() { - std::string url; - // Get path string. - if (args_->GetString(0, &url)) - MediaPlayer::GetInstance()->SetPlaybackError(GURL(url)); - return true; -} - -bool TogglePlaylistPanelMediaplayerFunction::RunImpl() { - MediaPlayer::GetInstance()->TogglePlaylistWindowVisible(); - return true; -} - -bool ToggleFullscreenMediaplayerFunction::RunImpl() { - MediaPlayer::GetInstance()->ToggleFullscreen(); - return true; -} diff --git a/chrome/browser/extensions/extension_mediaplayer_private_api.h b/chrome/browser/extensions/extension_mediaplayer_private_api.h deleted file mode 100644 index 42665ea..0000000 --- a/chrome/browser/extensions/extension_mediaplayer_private_api.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MEDIAPLAYER_PRIVATE_API_H_ -#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MEDIAPLAYER_PRIVATE_API_H_ -#pragma once - -#include <map> -#include <string> -#include <vector> - -#include "chrome/browser/extensions/extension_function.h" - -// Implements the chrome.mediaplayerPrivate.playAt method. -class PlayAtMediaplayerFunction - : public SyncExtensionFunction { - protected: - // AsyncExtensionFunction overrides. - virtual bool RunImpl() OVERRIDE; - DECLARE_EXTENSION_FUNCTION_NAME( - "mediaPlayerPrivate.playAt"); -}; - -// Implements the chrome.mediaPlayerPrivate.getCurrentPlaylist method. -class GetPlaylistMediaplayerFunction : public SyncExtensionFunction { - protected: - // AsyncExtensionFunction overrides. - virtual bool RunImpl() OVERRIDE; - DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.getPlaylist"); -}; - -// Implements the chrome.mediaPlayerPrivate.setPlaybackError method. -class SetPlaybackErrorMediaplayerFunction : public SyncExtensionFunction { - protected: - // AsyncExtensionFunction overrides. - virtual bool RunImpl() OVERRIDE; - DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.setPlaybackError"); -}; - -// Implements the chrome.mediaPlayerPrivate.togglePlaylist method. -class TogglePlaylistPanelMediaplayerFunction : public SyncExtensionFunction { - protected: - // AsyncExtensionFunction overrides. - virtual bool RunImpl() OVERRIDE; - DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.togglePlaylistPanel"); -}; - -// Implements the chrome.mediaPlayerPrivate.toggleFullscreen method. -class ToggleFullscreenMediaplayerFunction : public SyncExtensionFunction { - protected: - // AsyncExtensionFunction overrides. - virtual bool RunImpl() OVERRIDE; - DECLARE_EXTENSION_FUNCTION_NAME("mediaPlayerPrivate.toggleFullscreen"); -}; - -#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MEDIAPLAYER_PRIVATE_API_H_ diff --git a/chrome/browser/platform_util_chromeos.cc b/chrome/browser/platform_util_chromeos.cc index e8a76ef..5f3932d 100644 --- a/chrome/browser/platform_util_chromeos.cc +++ b/chrome/browser/platform_util_chromeos.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,7 @@ #include "base/callback.h" #include "base/file_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd index dc768a5..354ac96 100644 --- a/chrome/browser/resources/component_extension_resources.grd +++ b/chrome/browser/resources/component_extension_resources.grd @@ -163,6 +163,22 @@ <include name="IDR_FILE_MANAGER_IMG_MEDIA_VOLUME_SLIDER_THUMB_DISABLED" file="file_manager/images/media/media_volume_slider_thumb_disabled.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_IMG_MEDIA_VOLUME_SLIDER_THUMB_DOWN" file="file_manager/images/media/media_volume_slider_thumb_down.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_IMG_MEDIA_VOLUME_SLIDER_THUMB_HOVER" file="file_manager/images/media/media_volume_slider_thumb_hover.png" type="BINDATA" /> + + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_CLOSE" file="file_manager/images/media/media_close.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_COLLAPSE" file="file_manager/images/media/media_collapse.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_EXPAND" file="file_manager/images/media/media_expand.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_NEXT" file="file_manager/images/media/media_next.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_NEXT_HOVER" file="file_manager/images/media/media_next_down.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_NEXT_DOWN" file="file_manager/images/media/media_next_hover.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PAUSE" file="file_manager/images/media/media_pause_audio.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PAUSE_HOVER" file="file_manager/images/media/media_pause_audio_hover.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PAUSE_DOWN" file="file_manager/images/media/media_pause_audio_down.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PLAY" file="file_manager/images/media/media_play_audio.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PLAY_HOVER" file="file_manager/images/media/media_play_audio_hover.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PLAY_DOWN" file="file_manager/images/media/media_play_audio_down.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PREVIOUS" file="file_manager/images/media/media_previous.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PREVIOUS_HOVER" file="file_manager/images/media/media_previous_hover.png" type="BINDATA" /> + <include name="IDR_FILE_MANAGER_MEDIAPLAYER_PREVIOUS_DOWN" file="file_manager/images/media/media_previous_down.png" type="BINDATA" /> </if> <if expr="pp_ifdef('use_virtual_keyboard')"> diff --git a/chrome/browser/resources/file_manager/css/audio_player.css b/chrome/browser/resources/file_manager/css/audio_player.css index 7a0694f..7565531 100644 --- a/chrome/browser/resources/file_manager/css/audio_player.css +++ b/chrome/browser/resources/file_manager/css/audio_player.css @@ -6,6 +6,7 @@ body { padding: 0; + -webkit-user-select: none; } .audio-player { @@ -19,7 +20,7 @@ body { background-color: #1d1d1d; font-family: Open Sans,Droid Sans Fallback,sans-serif; - font-size: 13pt; + font-size: 10pt; } /* Title buttons. @@ -34,6 +35,7 @@ body { cursor: pointer; background-repeat: no-repeat; background-position: center center; + z-index: 2; } .title-button:hover { @@ -63,17 +65,19 @@ body { display: none; } -/* Playlist. */ - -.audio-player > .playlist { +/* Common properties for track containers. */ +.audio-player > .track-list, +.audio-player > .track-stack { position: absolute; - - border-top: 1px solid rgba(255, 255, 255, 0.1); - - top: -1px; /* Hide the border in the collapsed state. */ left: 0; right: 0; bottom: 35px; /* Room for the controls bar. */ +} + +/* Scrollable list of tracks. + Displayed in expanded mode if there is more than one track. */ +.audio-player > .track-list { + border-top: 1px solid rgba(255, 255, 255, 0.1); display: -webkit-box; -webkit-box-orient: vertical; @@ -84,52 +88,101 @@ body { overflow-y: auto; } -.audio-player:not(.collapsed):not(.single-track) > .playlist { - top: 29px; /* Room for the title buttons. */ +/* A single track container. + Displayed in the compact mode or when there is only one track. */ +.audio-player > .track-stack { + height: 58px; +} + +.audio-player.collapsed > .track-list, +.audio-player.single_track > .track-list, +.audio-player:not(.collapsed):not(.single-track) > .track-stack { + opacity: 0; + pointer-events: none; } +/* Track item. */ .track { width: 100%; height: 58px; - display: none; + display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-align: center; -webkit-box-pack: start; } -.audio-player:not(.collapsed):not(.single-track) .track, -.track.selected { - display: -webkit-box; -} - -.track.selected { +/* In the expanded mode the selected track is highlighted. */ +.track-list .track.selected { background-color: #2d2d2d; } -.track:hover { +.track-list .track:hover { background-color: #272727 !important; } +.track-list .track:not(.selected) .data { + opacity: 0.7; +} + +/* In the compact mode all tracks are in the same position, only the selected + is visible.*/ +.track-stack > .track { + position: absolute; + top: 0; +} + +.track-stack > .track.selected { + z-index: 1; +} + +/* Opacity transition is controlled differently for the text and the artwork. + Text transition looks better if fade-in and fade-out go in parallel. + For the artwork we start fading out the old icon only after the new one + is completely opaque (otherwise when transitioning between identical icons + we see some fading because the background transpires). */ +.track-stack > .track:not(.selected) .data, +.track-stack > .track:not(.visible) .art { + -webkit-transition: opacity 220ms ease-out; + opacity: 0; +} + +/* Track data. */ + .track .art { + position: relative; width: 48px; height: 48px; - margin: 4px 8px 4px 4px; + margin: 4px 0px 6px 4px; + -webkit-box-sizing: border-box; +} + +.track .art.blank { + border: 1px solid #808080; + background-color: #1d1d1d; +} + +.track .art img { + width: 100%; + height: 100%; +} + +.track .art.blank img { + display: none; +} + +.noart .track .art { + display: none; } .track .data { - width: 220px; margin-right: 4px; + margin-left: 8px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-pack: center; - - opacity: 0.7; -} - -.track.selected .data { - opacity: 1; + -webkit-box-flex: 1; } .track .data .data-title, @@ -143,6 +196,14 @@ body { font-weight: bold; } +.single-track .data-title { + padding-right: 20px; +} + +.collapsed:not(.single-track) .data-title { + padding-right: 50px; +} + /* Controls bar. */ .audio-controls { @@ -198,18 +259,18 @@ body { min-height: 28px; padding-top: 100px; background-clip: padding-box; - background-color: rgba(255,255,255,0.05); + background-color: rgba(255,255,255,0.15); -webkit-box-shadow: inset 1px 1px 0px rgba(0,0,0,0.10), inset 0px -1px 0px rgba(0,0,0,0.07); } ::-webkit-scrollbar-thumb:hover { - background-color: rgba(255,255,255,0.13); + background-color: rgba(255,255,255,0.20); -webkit-box-shadow: inset 1px 1px 1px rgba(0,0,0,0.25); } ::-webkit-scrollbar-thumb:active { - background-color: rgba(255,255,255,0.2); + background-color: rgba(255,255,255,0.25); -webkit-box-shadow: inset 1px 1px 3px rgba(0,0,0,0.35); } diff --git a/chrome/browser/resources/file_manager/js/audio_player.js b/chrome/browser/resources/file_manager/js/audio_player.js index 59968c8..6742600 100644 --- a/chrome/browser/resources/file_manager/js/audio_player.js +++ b/chrome/browser/resources/file_manager/js/audio_player.js @@ -19,6 +19,9 @@ function AudioPlayer(container) { this.container_ = container; this.metadataProvider_ = new MetadataProvider(); this.currentTrack_ = -1; + this.playlistGeneration_ = 0; + + this.container_.classList.add('collapsed'); function createChild(opt_className, opt_tag) { var child = container.ownerDocument.createElement(opt_tag || 'div'); @@ -28,7 +31,11 @@ function AudioPlayer(container) { return child; } - this.playlist_ = createChild('playlist'); + // We create two separate containers (for expanded and compact view) and keep + // two sets of TrackInfo instances. We could fiddle with a single set instead + // but it would make keeping the list scroll position very tricky. + this.trackList_ = createChild('track-list'); + this.trackStack_ = createChild('track-stack'); createChild('title-button close').addEventListener( 'click', function() { chrome.mediaPlayerPrivate.closeWindow() }); @@ -43,74 +50,147 @@ function AudioPlayer(container) { } AudioPlayer.load = function() { + document.ondragstart = function(e) { e.preventDefault() }; + var player = new AudioPlayer(document.querySelector('.audio-player')); function getPlaylist() { - chrome.mediaPlayerPrivate.getPlaylist(true, player.load.bind(player)); + chrome.mediaPlayerPrivate.getPlaylist(player.load.bind(player)); } getPlaylist(); chrome.mediaPlayerPrivate.onPlaylistChanged.addListener(getPlaylist); }; AudioPlayer.prototype.load = function(playlist) { - this.stopTrack_(); + this.playlistGeneration_++; - this.playlist_.textContent = ''; + this.audioControls_.pause(); - this.trackInfo_ = []; + this.currentTrack_ = -1; - for (var i = 0; i != playlist.items.length; i++) { - var url = playlist.items[i].path; - var trackInfo = new AudioPlayer.TrackInfo( - this.playlist_, url, this.select_.bind(this, i)); - this.metadataProvider_.fetch(url, trackInfo.setMetadata.bind(trackInfo)); - this.trackInfo_.push(trackInfo); - } + this.urls_ = playlist.items; - if (this.trackInfo_.length == 1) + if (this.urls_.length == 1) this.container_.classList.add('single-track'); else this.container_.classList.remove('single-track'); - this.currentTrack_ = 0; - this.playTrack_(); - this.syncHeight_(); -}; -AudioPlayer.prototype.select_ = function(track) { - if (this.currentTrack_ != track) { - this.stopTrack_(); - this.currentTrack_ = track; - this.playTrack_(); + this.trackList_.textContent = ''; + this.trackStack_.textContent = ''; + + this.trackListItems_ = []; + this.trackStackItems_ = []; + + for (var i = 0; i != this.urls_.length; i++) { + var url = this.urls_[i]; + var onClick = this.select_.bind(this, i); + this.trackListItems_.push( + new AudioPlayer.TrackInfo(this.trackList_, url, onClick)); + this.trackStackItems_.push( + new AudioPlayer.TrackInfo(this.trackStack_, url, onClick)); } -}; -AudioPlayer.prototype.stopTrack_ = function() { - if (this.currentTrack_ != -1) { - this.audioControls_.pause(); - this.trackInfo_[this.currentTrack_].select(false); + this.select_(playlist.position); + + // This class will be removed if at least one track has art. + this.container_.classList.add('noart'); + + // Load the selected track metadata first, then load the rest. + this.loadMetadata_(playlist.position); + for (i = 0; i != this.urls_.length; i++) { + if (i != playlist.position) + this.loadMetadata_(i); } }; -AudioPlayer.prototype.playTrack_ = function() { - var trackInfo = this.trackInfo_[this.currentTrack_]; +AudioPlayer.prototype.loadMetadata_ = function(track) { + this.metadataProvider_.fetch( + this.urls_[track], + function(generation, metadata) { + // Do nothing if another load happened since the metadata request. + if (this.playlistGeneration_ != generation) + return; + + if (metadata.thumbnailURL) { + this.container_.classList.remove('noart'); + } + this.trackListItems_[track].setMetadata(metadata); + this.trackStackItems_[track].setMetadata(metadata); + }.bind(this, this.playlistGeneration_)); +}; + +AudioPlayer.prototype.select_ = function(newTrack) { + if (this.currentTrack_ == newTrack) return; + + this.changeSelectionInList_(this.currentTrack_, newTrack); + this.changeSelectionInStack_(this.currentTrack_, newTrack); + + this.currentTrack_ = newTrack; + this.scrollToCurrent_(false); + var media = this.audioControls_.getMedia(); - trackInfo.select(true); - media.src = trackInfo.getUrl(); + media.src = this.urls_[this.currentTrack_]; media.load(); this.audioControls_.play(); }; +AudioPlayer.prototype.changeSelectionInList_ = function(oldTrack, newTrack) { + this.trackListItems_[newTrack].getBox().classList.add('selected'); + + if (oldTrack >= 0) { + this.trackListItems_[oldTrack].getBox().classList.remove('selected'); + } +}; + +AudioPlayer.prototype.changeSelectionInStack_ = function(oldTrack, newTrack) { + var newBox = this.trackStackItems_[newTrack].getBox(); + newBox.classList.add('selected'); // Put on top immediately. + newBox.classList.add('visible'); // Start fading in. + + if (oldTrack >= 0) { + var oldBox = this.trackStackItems_[oldTrack].getBox(); + oldBox.classList.remove('selected'); // Put under immediately. + setTimeout(function () { + if (!oldBox.classList.contains('selected')) { + // This will start fading out which is not really necessary because + // oldBox is already completely obscured by newBox. + oldBox.classList.remove('visible'); + } + }, 300); + } +}; + +/** + * Scrolls the current track into the viewport. + * + * @param {boolean} keepAtBottom If true, make the selected track the last + * of the visible (if possible). If false, perform minimal scrolling. + */ +AudioPlayer.prototype.scrollToCurrent_ = function(keepAtBottom) { + var box = this.trackListItems_[this.currentTrack_].getBox(); + this.trackList_.scrollTop = Math.max( + keepAtBottom ? 0 : Math.min(box.offsetTop, this.trackList_.scrollTop), + box.offsetTop + box.offsetHeight - this.trackList_.clientHeight); +}; + +AudioPlayer.prototype.isCompact_ = function() { + return this.container_.classList.contains('collapsed') || + this.container_.classList.contains('single-track'); +}; + AudioPlayer.prototype.advance_ = function(forward) { var newTrack = this.currentTrack_ + (forward ? 1 : -1); - if (newTrack < 0) newTrack = this.trackInfo_.length - 1; - if (newTrack == this.trackInfo_.length) newTrack = 0; + if (newTrack < 0) newTrack = this.urls_.length - 1; + if (newTrack == this.urls_.length) newTrack = 0; this.select_(newTrack); }; AudioPlayer.prototype.onExpandCollapse_ = function() { this.container_.classList.toggle('collapsed'); this.syncHeight_(); + if (!this.isCompact_()) + this.scrollToCurrent_(true); }; /* Keep the below constants in sync with the CSS. */ @@ -119,12 +199,14 @@ AudioPlayer.TRACK_HEIGHT = 58; AudioPlayer.CONTROLS_HEIGHT = 35; AudioPlayer.prototype.syncHeight_ = function() { - var collapsed = this.container_.classList.contains('collapsed'); - var singleTrack = this.container_.classList.contains('single-track'); - var visibleTracks = Math.min(this.trackInfo_.length, collapsed ? 1 : 3); + var expandedListHeight = + Math.min(this.urls_.length, 3) * AudioPlayer.TRACK_HEIGHT; + this.trackList_.style.height = expandedListHeight + 'px'; + chrome.mediaPlayerPrivate.setWindowHeight( - ((collapsed || singleTrack)? 0 : AudioPlayer.HEADER_HEIGHT) + - visibleTracks * AudioPlayer.TRACK_HEIGHT + + (this.isCompact_() ? + AudioPlayer.TRACK_HEIGHT : + AudioPlayer.HEADER_HEIGHT + expandedListHeight) + AudioPlayer.CONTROLS_HEIGHT); }; @@ -147,10 +229,13 @@ AudioPlayer.TrackInfo = function(container, url, onClick) { this.box_.addEventListener('click', onClick); container.appendChild(this.box_); - this.art_ = doc.createElement('img'); - this.art_.className = 'art'; + this.art_ = doc.createElement('div'); + this.art_.className = 'art blank'; this.box_.appendChild(this.art_); + this.img_ = doc.createElement('img'); + this.art_.appendChild(this.img_); + this.data_ = doc.createElement('div'); this.data_.className = 'data'; this.box_.appendChild(this.data_); @@ -164,11 +249,7 @@ AudioPlayer.TrackInfo = function(container, url, onClick) { this.data_.appendChild(this.artist_); }; -AudioPlayer.TrackInfo.prototype.getUrl = function() { return this.url_ }; - -AudioPlayer.TrackInfo.prototype.getDefaultArtwork = function() { - return 'images/filetype_large_audio.png'; -}; +AudioPlayer.TrackInfo.prototype.getBox = function() { return this.box_ }; AudioPlayer.TrackInfo.prototype.getDefaultTitle = function() { var title = this.url_.split('/').pop(); @@ -182,21 +263,10 @@ AudioPlayer.TrackInfo.prototype.getDefaultArtist = function() { }; AudioPlayer.TrackInfo.prototype.setMetadata = function(metadata) { - this.art_.src = metadata.thumbnailURL || this.getDefaultArtwork(); + if (metadata.thumbnailURL) { + this.art_.classList.remove('blank'); + this.img_.src = metadata.thumbnailURL; + } this.title_.textContent = metadata.title || this.getDefaultTitle(); this.artist_.textContent = metadata.artist || this.getDefaultArtist(); -}; - -AudioPlayer.TrackInfo.prototype.select = function(on) { - if (on) { - this.box_.classList.add('selected'); - - // Scroll if necessary to make the selected item fully visible. - var parent = this.box_.parentNode; - parent.scrollTop = Math.max( - this.box_.offsetTop + this.box_.offsetHeight - parent.offsetHeight, - Math.min(this.box_.offsetTop, parent.scrollTop)); - } else { - this.box_.classList.remove('selected'); - } -}; +};
\ No newline at end of file diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js index f3f32d2..7fe9c02 100644 --- a/chrome/browser/resources/file_manager/js/file_manager.js +++ b/chrome/browser/resources/file_manager/js/file_manager.js @@ -2119,10 +2119,6 @@ FileManager.prototype = { chrome.extension.getURL('images/icon_play_16x16.png'); task.title = str('PLAY_MEDIA').replace("&", ""); this.playTask_ = task; - } else if (task_parts[1] == 'enqueue') { - task.iconUrl = - chrome.extension.getURL('images/icon_add_to_queue_16x16.png'); - task.title = str('ENQUEUE'); } else if (task_parts[1] == 'mount-archive') { task.iconUrl = chrome.extension.getURL('images/icon_mount_archive_16x16.png'); @@ -2241,17 +2237,21 @@ FileManager.prototype = { return; } - function callback(success) { - if (!success && selection.entries.length == 1) - this.alert.showWithTitle( - unescape(selection.entries[0].name), - strf('ERROR_VIEWING_FILE'), - function() {}); - } + if (selection.urls.length == 1) { + // We don't have tasks, so try the default browser action. + // We only do that for single selection to avoid confusion. + + function callback(success) { + if (!success && selection.entries.length == 1) + this.alert.showWithTitle( + unescape(selection.entries[0].name), + strf('ERROR_VIEWING_FILE'), + function() {}); + } - // We don't have tasks, so try the default browser action. - chrome.fileBrowserPrivate.viewFiles(selection.urls, 'default', - callback.bind(this)); + chrome.fileBrowserPrivate.viewFiles(selection.urls, 'default', + callback.bind(this)); + } }; FileManager.prototype.dispatchFileTask_ = function(task, urls) { @@ -2332,9 +2332,18 @@ FileManager.prototype = { */ FileManager.prototype.onFileTaskExecute_ = function(id, details) { var urls = details.urls; - if (id == 'play' || id == 'enqueue') { - // The Media Player popup is now only used to play audio. - chrome.fileBrowserPrivate.viewFiles(urls, id); + if (id == 'play') { + var position = 0; + if (urls.length == 1) { + // If just a single audio file is selected pass along every audio file + // in the directory. + var selectedUrl = urls[0]; + urls = this.getAllUrlsInCurrentDirectory_().filter(function(url) { + return FileType.getMediaType(url) == 'audio'; + }); + position = urls.indexOf(selectedUrl); + } + chrome.mediaPlayerPrivate.play(urls, position); } else if (id == 'mount-archive') { for (var index = 0; index < urls.length; ++index) { // Url in MountCompleted event won't be escaped, so let's make sure @@ -2373,6 +2382,15 @@ FileManager.prototype = { return undefined; }; + FileManager.prototype.getAllUrlsInCurrentDirectory_ = function() { + var urls = []; + var dm = this.directoryModel_.fileList; + for (var i = 0; i != dm.length; i++) { + urls.push(dm.item(i).toURL()); + } + return urls; + } + FileManager.prototype.openGallery_ = function(urls, shareActions) { var self = this; @@ -2389,16 +2407,10 @@ FileManager.prototype = { // in the ribbon. // We do not do that if a single video is selected because the UI is // cleaner without the ribbon. - urls = []; - var dm = this.directoryModel_.fileList; - for (var i = 0; i != dm.length; i++) { - var entry = dm.item(i); - var url = entry.toURL(); + urls = this.getAllUrlsInCurrentDirectory_().filter(function(url) { var type = FileType.getMediaType(url); - if (type == 'image' || type == 'video') { - urls.push(url); - } - } + return type == 'image' || type == 'video'; + }); } else { // Pass just the selected items, select the first entry. selectedUrl = urls[0]; diff --git a/chrome/browser/resources/file_manager/js/mock_chrome.js b/chrome/browser/resources/file_manager/js/mock_chrome.js index 5eda776..14f0d1a 100644 --- a/chrome/browser/resources/file_manager/js/mock_chrome.js +++ b/chrome/browser/resources/file_manager/js/mock_chrome.js @@ -40,9 +40,9 @@ chrome.fileBrowserPrivate = { viewFiles: function(selectedFiles) { console.log('viewFiles called: ' + selectedFiles.length + ' files selected'); - chrome.mediaPlayerPrivate.setPlaylist_({ - items: selectedFiles.map(function(url) { return {path: url} }) - }); + for (var i = 0; i != selectedFiles.length; i++) { + window.open(selectedFiles[i]); + } }, /** @@ -398,8 +398,8 @@ chrome.mediaPlayerPrivate = { onPlaylistChanged: new MockEventSource(), - setPlaylist_: function(playlist) { - this.playlist_ = playlist; + play: function(urls, position) { + this.playlist_ = { items: urls, position: position }; if (this.popup_) { this.onPlaylistChanged.notify(); @@ -410,7 +410,8 @@ chrome.mediaPlayerPrivate = { this.popup_ = document.createElement('iframe'); this.popup_.scrolling = 'no'; this.popup_.style.cssText = 'position:absolute; border:none; z-index:10;' + - 'width:280px; height:0; right:10px; bottom:80px'; + 'width:280px; height:93px; right:10px; bottom:80px;' + + '-webkit-transition: height 200ms ease'; document.body.appendChild(this.popup_); @@ -423,7 +424,7 @@ chrome.mediaPlayerPrivate = { this.popup_.src = "mediaplayer.html?no_auto_load"; }, - getPlaylist: function(flag, callback) { + getPlaylist: function(callback) { callback(this.playlist_); }, diff --git a/chrome/browser/resources/file_manager/manifest.json b/chrome/browser/resources/file_manager/manifest.json index 96d7926..34fbea4 100644 --- a/chrome/browser/resources/file_manager/manifest.json +++ b/chrome/browser/resources/file_manager/manifest.json @@ -41,19 +41,6 @@ ] }, { - "id": "enqueue", - "default_title": "__MSG_ENQUEUE_MEDIA__", - "default_icon": "images/icon_add_to_queue_16x16.png", - "file_filters": [ - "filesystem:*.flac", - "filesystem:*.m4a", - "filesystem:*.mp3", - "filesystem:*.oga", - "filesystem:*.ogg", - "filesystem:*.wav" - ] - }, - { "id": "mount-archive", "default_title": "__MSG_MOUNT_ARCHIVE__", "default_icon": "images/icon_mount_archive_16x16.png", diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 8b69855..8420bdf 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -85,7 +85,7 @@ #include "webkit/glue/webmenuitem.h" #ifdef FILE_MANAGER_EXTENSION -#include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #endif using content::ChildProcessSecurityPolicy; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 3a3e35f..8f5ebb8 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -220,7 +220,7 @@ #endif #if defined(FILE_MANAGER_EXTENSION) -#include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #endif using base::TimeDelta; diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc index 51a3e55..7c3631e 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc @@ -10,10 +10,10 @@ #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" #include "base/message_loop.h" -#include "chrome/browser/extensions/extension_file_browser_private_api.h" +#include "chrome/browser/chromeos/extensions/file_browser_private_api.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/file_manager_util.h" #include "chrome/browser/sessions/restore_tab_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" diff --git a/chrome/browser/ui/webui/active_downloads_ui.cc b/chrome/browser/ui/webui/active_downloads_ui.cc index f68020d..0d329a8 100644 --- a/chrome/browser/ui/webui/active_downloads_ui.cc +++ b/chrome/browser/ui/webui/active_downloads_ui.cc @@ -23,6 +23,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #include "chrome/browser/chromeos/media/media_player.h" #include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/download_prefs.h" @@ -30,7 +31,6 @@ #include "chrome/browser/download/download_service_factory.h" #include "chrome/browser/download/download_util.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/file_manager_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tabs/tab_strip_model.h" #include "chrome/browser/ui/browser.h" diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc index 862d238..08fc6d8 100644 --- a/chrome/browser/ui/webui/downloads_dom_handler.cc +++ b/chrome/browser/ui/webui/downloads_dom_handler.cc @@ -40,7 +40,7 @@ #endif #if defined(OS_CHROMEOS) -#include "chrome/browser/extensions/file_manager_util.h" +#include "chrome/browser/chromeos/extensions/file_manager_util.h" #endif using content::BrowserThread; diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e2cbcf6..d2c1786 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -489,6 +489,10 @@ 'browser/chromeos/extensions/file_browser_event_router.h', 'browser/chromeos/extensions/file_browser_notifications.cc', 'browser/chromeos/extensions/file_browser_notifications.h', + 'browser/chromeos/extensions/file_browser_private_api.cc', + 'browser/chromeos/extensions/file_browser_private_api.h', + 'browser/chromeos/extensions/file_manager_util.cc', + 'browser/chromeos/extensions/file_manager_util.h', 'browser/chromeos/extensions/input_method_event_router.cc', 'browser/chromeos/extensions/input_method_event_router.h', 'browser/chromeos/extensions/media_player_event_router.cc', @@ -706,6 +710,8 @@ 'browser/chromeos/login/wizard_screen.h', 'browser/chromeos/media/media_player.cc', 'browser/chromeos/media/media_player.h', + 'browser/chromeos/media/media_player_extension_api.cc', + 'browser/chromeos/media/media_player_extension_api.h', 'browser/chromeos/mobile_config.cc', 'browser/chromeos/mobile_config.h', 'browser/chromeos/native_dialog_window.cc', @@ -1123,8 +1129,6 @@ 'browser/extensions/extension_event_router.h', 'browser/extensions/extension_event_router_forwarder.cc', 'browser/extensions/extension_event_router_forwarder.h', - 'browser/extensions/extension_file_browser_private_api.cc', - 'browser/extensions/extension_file_browser_private_api.h', 'browser/extensions/extension_font_settings_api.cc', 'browser/extensions/extension_font_settings_api.h', 'browser/extensions/extension_function.cc', @@ -1173,8 +1177,6 @@ 'browser/extensions/extension_management_api.h', 'browser/extensions/extension_management_api_constants.cc', 'browser/extensions/extension_management_api_constants.h', - 'browser/extensions/extension_mediaplayer_private_api.cc', - 'browser/extensions/extension_mediaplayer_private_api.h', 'browser/extensions/extension_menu_manager.cc', 'browser/extensions/extension_menu_manager.h', 'browser/extensions/extension_message_handler.cc', @@ -1294,8 +1296,6 @@ 'browser/extensions/external_pref_extension_loader.h', 'browser/extensions/external_registry_extension_loader_win.cc', 'browser/extensions/external_registry_extension_loader_win.h', - 'browser/extensions/file_manager_util.cc', - 'browser/extensions/file_manager_util.h', 'browser/extensions/file_reader.cc', 'browser/extensions/file_reader.h', 'browser/extensions/image_loading_tracker.cc', @@ -4468,12 +4468,12 @@ }], ['file_manager_extension==0', { 'sources/': [ - ['exclude', 'browser/extensions/extension_file_browser_private_api.cc'], - ['exclude', 'browser/extensions/extension_file_browser_private_api.h'], - ['exclude', 'browser/extensions/extension_mediaplayer_private_api.cc'], - ['exclude', 'browser/extensions/extension_mediaplayer_private_api.h'], - ['exclude', 'browser/extensions/file_manager_util.h'], - ['exclude', 'browser/extensions/file_manager_util.cc'], + ['exclude', 'browser/chromeos/media/media_player_extension_api.cc'], + ['exclude', 'browser/chromeos/media/media_player_extension_api.h'], + ['exclude', 'browser/chromeos/extensions/file_browser_private_api.cc'], + ['exclude', 'browser/chromeos/extensions/file_browser_private_api.h'], + ['exclude', 'browser/chromeos/extensions/file_manager_util.h'], + ['exclude', 'browser/chromeos/extensions/file_manager_util.cc'], ], }], ['use_ibus==1', { @@ -5306,7 +5306,7 @@ # non-ChromeOS views Linux builds. ['OS=="linux" and toolkit_views==1 and chromeos==0', { 'sources/': [ - ['exclude', '^browser/extensions/extension_file_browser_private_api'], + ['exclude', '^browser/chromeos/extensions/file_browser_private_api'], ['include', '^browser/ui/gtk/select_file_dialog_impl.cc'], ['include', '^browser/ui/gtk/select_file_dialog_impl.h'], ['include', '^browser/ui/gtk/select_file_dialog_impl_gtk.cc'], @@ -5340,18 +5340,6 @@ ['exclude', '^browser/ui/views/status_icons/status_tray_linux.cc'], ], }], - # Exclude file manager files again - # (Required because of the '^browser/extensions/' include above) - ['file_manager_extension==0', { - 'sources/': [ - ['exclude', 'browser/extensions/extension_file_browser_private_api.cc'], - ['exclude', 'browser/extensions/extension_file_browser_private_api.h'], - ['exclude', 'browser/extensions/extension_mediaplayer_private_api.cc'], - ['exclude', 'browser/extensions/extension_mediaplayer_private_api.h'], - ['exclude', 'browser/extensions/file_manager_util.h'], - ['exclude', 'browser/extensions/file_manager_util.cc'], - ], - }], # GTK build only ['toolkit_uses_gtk == 1 and toolkit_views == 0', { 'sources/': [ diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 3df5f93..95c93ce 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2536,6 +2536,7 @@ 'browser/chromeos/disks/mock_disk_mount_manager.cc', 'browser/chromeos/disks/mock_disk_mount_manager.h', 'browser/chromeos/extensions/file_browser_notifications_browsertest.cc', + 'browser/chromeos/extensions/file_browser_private_apitest.cc', 'browser/chromeos/input_method/input_method_manager_browsertest.cc', 'browser/chromeos/login/enrollment/enterprise_enrollment_screen_browsertest.cc', 'browser/chromeos/login/existing_user_controller_browsertest.cc', @@ -2634,7 +2635,6 @@ 'browser/extensions/extension_devtools_browsertest.h', 'browser/extensions/extension_devtools_browsertests.cc', 'browser/extensions/extension_dom_clipboard_apitest.cc', - 'browser/extensions/extension_file_browser_private_apitest.cc', 'browser/extensions/extension_fileapi_apitest.cc', 'browser/extensions/extension_font_settings_apitest.cc', 'browser/extensions/extension_function_test_utils.cc', @@ -2912,8 +2912,8 @@ ['exclude', '^browser/chromeos'], ], 'sources!': [ + 'browser/chromeos/extensions/file_browser_private_apitest.cc', 'browser/chromeos/media/media_player_browsertest.cc', - 'browser/extensions/extension_file_browser_private_apitest.cc', 'browser/extensions/extension_input_method_apitest.cc', 'browser/extensions/api/terminal/terminal_private_apitest.cc', 'browser/oom_priority_manager_browsertest.cc', diff --git a/chrome/common/extensions/api/mediaPlayerPrivate.json b/chrome/common/extensions/api/mediaPlayerPrivate.json index 973e933..d7b4ea0 100644 --- a/chrome/common/extensions/api/mediaPlayerPrivate.json +++ b/chrome/common/extensions/api/mediaPlayerPrivate.json @@ -11,60 +11,40 @@ "items": { "name": "items", "type": "array", - "items": { - "type": "object", - "properties": { - "path": { "type": "string", "description": "URL of mediafile (in 'filesystem:' scheme for local files)." }, - "error": { "type": "boolean", "description": "True if the file has failed to play ('playbackError' with its URL called)." } - } - } + "description": "Array of URLs for media files (in 'filesystem:' scheme for local files)", + "items": { "type": "string" } }, "position": { "type": "integer", - "description": "Index of item in the 'items' array to play next." - }, - "pendingPlaybackRequest": { - "type": "boolean", - "optional": "true", - "description": "Informs that a request to play current item has been received. This flag is reset automatically." + "description": "A position in the playlist." } } } ], "functions": [ { - "name": "playAt", - "description": "Sets playlist positions and sets flag of pending play request. Then fires the onPlaylistChanged event.", + "name": "play", + "description": "Plays a new playlist from a given position.", "parameters": [ { + "name": "items", + "type": "array", + "description": "Array of URLs for media files (in 'filesystem:' scheme for local files)", + "items": { "type": "string" } + }, + { "name": "position", "type": "integer", - "description": "New position in the playlist." - } - ] - }, - { - "name": "setPlaybackError", - "description": "Marks the URL as failed to play one. Mediaplayer will visually marks such an item. Then fires the onPlaylistChanged event.", - "parameters": [ - { - "name": "url", - "type": "string", - "description": "URL failed to play." + "description": "A position in the playlist." } ] }, { "name": "getPlaylist", "type": "function", - "description": "Returns current play list, position and flag of penging play request.", + "description": "Returns current playlist and position.", "parameters": [ { - "name": "resetPendingPlaybackRequest", - "type": "boolean", - "description": "If true the result will include pending playback request status and this status will be reset." - }, - { "name": "callback", "type": "function", "description": "Callback to retrieve the playlist.", @@ -79,18 +59,19 @@ ] }, { - "name": "togglePlaylistPanel", - "description": "Shows or hides the playlist panel.", - "parameters": [] - }, - { - "name": "toggleFullscreen", - "description": "Switches fullscreen mode on/off for the mediaplayer.", - "parameters": [] + "name": "setWindowHeight", + "description": "Changes the height of the media player window.", + "parameters": [ + { + "name": "height", + "type": "integer", + "description": "Height of the media player window (not including window title or borders)." + } + ] }, { - "name": "showPlaylistPanel", - "description": "Shows the playlist panel.", + "name": "closeWindow", + "description": "Closes the media player window.", "parameters": [] } ], diff --git a/chrome/test/data/extensions/api_test/filebrowser_mount/test.js b/chrome/test/data/extensions/api_test/filebrowser_mount/test.js index af1df1a68..27621d0 100644 --- a/chrome/test/data/extensions/api_test/filebrowser_mount/test.js +++ b/chrome/test/data/extensions/api_test/filebrowser_mount/test.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// These have to be sync'd with extension_file_browser_private_apitest.cc +// These have to be sync'd with file_browser_private_apitest.cc var expectedVolume1 = { devicePath: 'device_path1', mountPath: 'removable/mount_path1', |