1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_
6 #define CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_
10 #include "base/memory/singleton.h"
12 template <typename T
> struct DefaultSingletonTraits
;
19 typedef std::vector
<GURL
> UrlVector
;
21 virtual ~MediaPlayer();
23 // Adjusts the mediaplayer window height.
24 void AdjustWindowHeight(int height_diff
);
26 // Forces the mediaplayer window to be closed.
29 // Clears the current playlist.
32 // Enqueues this fileschema url into the current playlist.
33 void EnqueueMediaFileUrl(const GURL
& url
);
35 // Clears out the current playlist, and start playback of the given url.
36 void ForcePlayMediaURL(const GURL
& url
);
38 // Popup the mediaplayer, this shows the browser, and sets up its
39 // locations correctly.
40 void PopupMediaPlayer();
42 // Sets the currently playing element to the given positions.
43 void SetPlaylistPosition(int position
);
45 // Returns current playlist.
46 const UrlVector
& GetPlaylist() const;
48 // Returns current playlist position.
49 int GetPlaylistPosition() const;
51 // Notfies the mediaplayer that the playlist changed. This could be
52 // called from the mediaplayer itself for example.
53 void NotifyPlaylistChanged();
55 // Getter for the singleton.
56 static MediaPlayer
* GetInstance();
59 friend class MediaPlayerBrowserTest
;
60 friend struct DefaultSingletonTraits
<MediaPlayer
>;
62 // The current playlist of urls.
63 UrlVector current_playlist_
;
65 // The position into the current_playlist_ of the currently playing item.
66 int current_position_
;
70 static GURL
GetMediaPlayerUrl();
72 // Browser containing the Mediaplayer.
73 static Browser
* GetBrowser();
75 DISALLOW_COPY_AND_ASSIGN(MediaPlayer
);
78 #endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_