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