| 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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| 6 #define CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "content/browser/renderer_host/media/media_observer.h" | 13 #include "content/browser/renderer_host/media/media_observer.h" |
| 14 | 14 |
| 15 class MediaInternalsObserver; | 15 class MediaInternalsObserver; |
| 16 | 16 |
| 17 namespace media { |
| 18 struct MediaLogEvent; |
| 19 } |
| 20 |
| 17 // This class stores information about currently active media. | 21 // This class stores information about currently active media. |
| 18 // All of its methods are called on the IO thread. | 22 // All of its methods are called on the IO thread. |
| 19 class MediaInternals : public MediaObserver, public base::NonThreadSafe { | 23 class MediaInternals : public MediaObserver, public base::NonThreadSafe { |
| 20 public: | 24 public: |
| 21 virtual ~MediaInternals(); | 25 virtual ~MediaInternals(); |
| 22 | 26 |
| 23 // MediaObserver implementation. | 27 // MediaObserver implementation. |
| 24 virtual void OnDeleteAudioStream(void* host, int stream_id); | 28 virtual void OnDeleteAudioStream(void* host, int stream_id); |
| 25 virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); | 29 virtual void OnSetAudioStreamPlaying(void* host, int stream_id, bool playing); |
| 26 virtual void OnSetAudioStreamStatus(void* host, int stream_id, | 30 virtual void OnSetAudioStreamStatus(void* host, int stream_id, |
| 27 const std::string& status); | 31 const std::string& status); |
| 28 virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); | 32 virtual void OnSetAudioStreamVolume(void* host, int stream_id, double volume); |
| 33 virtual void OnMediaEvent(int source, const media::MediaLogEvent& event); |
| 29 | 34 |
| 30 // Methods for observers. | 35 // Methods for observers. |
| 31 // Observers should add themselves on construction and remove themselves | 36 // Observers should add themselves on construction and remove themselves |
| 32 // on destruction. | 37 // on destruction. |
| 33 void AddObserver(MediaInternalsObserver* observer); | 38 void AddObserver(MediaInternalsObserver* observer); |
| 34 void RemoveObserver(MediaInternalsObserver* observer); | 39 void RemoveObserver(MediaInternalsObserver* observer); |
| 35 void SendEverything(); | 40 void SendEverything(); |
| 36 | 41 |
| 37 private: | 42 private: |
| 38 friend class IOThread; | 43 friend class IOThread; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 58 void SendUpdate(const std::string& function, Value* value); | 63 void SendUpdate(const std::string& function, Value* value); |
| 59 | 64 |
| 60 static MediaInternals* instance_; | 65 static MediaInternals* instance_; |
| 61 DictionaryValue data_; | 66 DictionaryValue data_; |
| 62 ObserverList<MediaInternalsObserver> observers_; | 67 ObserverList<MediaInternalsObserver> observers_; |
| 63 | 68 |
| 64 DISALLOW_COPY_AND_ASSIGN(MediaInternals); | 69 DISALLOW_COPY_AND_ASSIGN(MediaInternals); |
| 65 }; | 70 }; |
| 66 | 71 |
| 67 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ | 72 #endif // CHROME_BROWSER_MEDIA_MEDIA_INTERNALS_H_ |
| OLD | NEW |