| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ | 5 #ifndef MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ |
| 6 #define MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ | 6 #define MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/sequence_checker.h" |
| 10 #include "base/strings/string_piece.h" | 11 #include "base/strings/string_piece.h" |
| 11 #include "base/threading/non_thread_safe.h" | |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 // This class is used for reproduction of system sounds. All methods | 17 // This class is used for reproduction of system sounds. All methods |
| 18 // should be accessed from the Audio thread. | 18 // should be accessed from the Audio thread. |
| 19 class MEDIA_EXPORT SoundsManager : public base::NonThreadSafe { | 19 class MEDIA_EXPORT SoundsManager { |
| 20 public: | 20 public: |
| 21 typedef int SoundKey; | 21 typedef int SoundKey; |
| 22 | 22 |
| 23 // Creates a singleton instance of the SoundsManager. | 23 // Creates a singleton instance of the SoundsManager. |
| 24 static void Create(); | 24 static void Create(); |
| 25 | 25 |
| 26 // Removes a singleton instance of the SoundsManager. | 26 // Removes a singleton instance of the SoundsManager. |
| 27 static void Shutdown(); | 27 static void Shutdown(); |
| 28 | 28 |
| 29 // Returns a pointer to a singleton instance of the SoundsManager. | 29 // Returns a pointer to a singleton instance of the SoundsManager. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 | 48 |
| 49 // Returns duration of the sound identified by |key|. If SoundsManager | 49 // Returns duration of the sound identified by |key|. If SoundsManager |
| 50 // was not properly initialized or |key| was not registered, this | 50 // was not properly initialized or |key| was not registered, this |
| 51 // method returns an empty value. | 51 // method returns an empty value. |
| 52 virtual base::TimeDelta GetDuration(SoundKey key) = 0; | 52 virtual base::TimeDelta GetDuration(SoundKey key) = 0; |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 SoundsManager(); | 55 SoundsManager(); |
| 56 virtual ~SoundsManager(); | 56 virtual ~SoundsManager(); |
| 57 | 57 |
| 58 SEQUENCE_CHECKER(sequence_checker_); |
| 59 |
| 58 private: | 60 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(SoundsManager); | 61 DISALLOW_COPY_AND_ASSIGN(SoundsManager); |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 } // namespace media | 64 } // namespace media |
| 63 | 65 |
| 64 #endif // MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ | 66 #endif // MEDIA_AUDIO_SOUNDS_SOUNDS_MANAGER_H_ |
| OLD | NEW |