OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
12 #include "content/public/browser/notification_observer.h" | |
13 #include "content/public/browser/notification_registrar.h" | |
14 #include "content/public/browser/notification_source.h" | |
15 #include "content/public/browser/notification_types.h" | |
16 | 11 |
17 template <typename T> struct DefaultSingletonTraits; | 12 template <typename T> struct DefaultSingletonTraits; |
18 | 13 |
19 class Browser; | 14 class Browser; |
20 class FilePath; | 15 class FilePath; |
21 class GURL; | 16 class GURL; |
22 class Profile; | 17 class Profile; |
23 | 18 |
24 class MediaPlayer : public content::NotificationObserver { | 19 class MediaPlayer { |
25 public: | 20 public: |
26 typedef std::vector<GURL> UrlVector; | 21 typedef std::vector<GURL> UrlVector; |
27 | 22 |
28 virtual ~MediaPlayer(); | 23 virtual ~MediaPlayer(); |
29 | 24 |
30 // Sets the mediaplayer window height. | 25 // Sets the mediaplayer window height. |
31 void SetWindowHeight(int height); | 26 void SetWindowHeight(int height); |
32 | 27 |
33 // Forces the mediaplayer window to be closed. | 28 // Forces the mediaplayer window to be closed. |
34 void CloseWindow(); | 29 void CloseWindow(); |
(...skipping 17 matching lines...) Expand all Loading... |
52 // Returns current playlist. | 47 // Returns current playlist. |
53 const UrlVector& GetPlaylist() const; | 48 const UrlVector& GetPlaylist() const; |
54 | 49 |
55 // Returns current playlist position. | 50 // Returns current playlist position. |
56 int GetPlaylistPosition() const; | 51 int GetPlaylistPosition() const; |
57 | 52 |
58 // Notfies the mediaplayer that the playlist changed. This could be | 53 // Notfies the mediaplayer that the playlist changed. This could be |
59 // called from the mediaplayer itself for example. | 54 // called from the mediaplayer itself for example. |
60 void NotifyPlaylistChanged(); | 55 void NotifyPlaylistChanged(); |
61 | 56 |
62 // Used to detect when the mediaplayer is closed. | |
63 virtual void Observe(int type, | |
64 const content::NotificationSource& source, | |
65 const content::NotificationDetails& details) OVERRIDE; | |
66 | |
67 // Getter for the singleton. | 57 // Getter for the singleton. |
68 static MediaPlayer* GetInstance(); | 58 static MediaPlayer* GetInstance(); |
69 | 59 |
70 private: | 60 private: |
71 friend struct DefaultSingletonTraits<MediaPlayer>; | 61 friend struct DefaultSingletonTraits<MediaPlayer>; |
72 | 62 |
73 // The current playlist of urls. | 63 // The current playlist of urls. |
74 UrlVector current_playlist_; | 64 UrlVector current_playlist_; |
75 // The position into the current_playlist_ of the currently playing item. | 65 // The position into the current_playlist_ of the currently playing item. |
76 int current_position_; | 66 int current_position_; |
77 | 67 |
78 bool pending_playback_request_; | |
79 | |
80 MediaPlayer(); | 68 MediaPlayer(); |
81 | 69 |
82 GURL GetMediaPlayerUrl() const; | 70 static GURL GetMediaPlayerUrl(); |
83 | 71 |
84 // Browser containing the Mediaplayer. Used to force closes. This is | 72 // Browser containing the Mediaplayer. |
85 // created by the PopupMediaplayer call, and is NULLed out when the window | 73 static Browser* GetBrowser(); |
86 // is closed. | |
87 Browser* mediaplayer_browser_; | |
88 | |
89 // Used to register for events on the windows, like to listen for closes. | |
90 content::NotificationRegistrar registrar_; | |
91 | 74 |
92 friend class MediaPlayerBrowserTest; | 75 friend class MediaPlayerBrowserTest; |
93 DISALLOW_COPY_AND_ASSIGN(MediaPlayer); | 76 DISALLOW_COPY_AND_ASSIGN(MediaPlayer); |
94 }; | 77 }; |
95 | 78 |
96 #endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ | 79 #endif // CHROME_BROWSER_CHROMEOS_MEDIA_MEDIA_PLAYER_H_ |
OLD | NEW |