OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 #ifndef MEDIA_BASE_MEDIA_RESOURCES_H_ |
| 6 #define MEDIA_BASE_MEDIA_RESOURCES_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/strings/string16.h" |
| 11 #include "media/base/media_export.h" |
| 12 |
| 13 namespace media { |
| 14 |
| 15 // The media layer can't access Chrome's resource bundle directly. This facility |
| 16 // allows clients to provide indirect access. |
| 17 |
| 18 // IDs that will get mapped to corresponding entries with IDS_ prefixes in |
| 19 // chrome/app/generated_resources.grd. |
| 20 enum MessageId { |
| 21 DEFAULT_AUDIO_DEVICE_NAME, |
| 22 #if defined(OS_WIN) |
| 23 COMMUNICATIONS_AUDIO_DEVICE_NAME, |
| 24 #endif |
| 25 #if defined(OS_CHROMEOS) |
| 26 BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 27 BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 28 #endif |
| 29 }; |
| 30 |
| 31 // Implementations are expected to convert MessageIds to generated_resources.grd |
| 32 // IDs and extract the matching string from Chrome's resource bundle (e.g. |
| 33 // through l10n_util::GetStringUTF16). |
| 34 using LocalizedStringProvider = base::string16 (*)(MessageId message_id); |
| 35 |
| 36 // Initializes the global LocalizedStringProvider function. |
| 37 MEDIA_EXPORT void SetLocalizedStringProvider(LocalizedStringProvider func); |
| 38 |
| 39 #if !defined(OS_IOS) |
| 40 // The LocalizedStringProvider has probably not been initialized on iOS. This |
| 41 // will give an early compile warning for clients attempting to use it. |
| 42 |
| 43 // Returns a resource string corresponding to |message_id|. See l10n_util.h. |
| 44 // Returns an empty string if the LocalizedStringProvider has not been |
| 45 // initialized or if the ID is unrecognized. |
| 46 std::string GetLocalizedStringUTF8(MessageId message_id); |
| 47 base::string16 GetLocalizedStringUTF16(MessageId message_id); |
| 48 #endif |
| 49 |
| 50 } // namespace media |
| 51 |
| 52 #endif // MEDIA_BASE_MEDIA_RESOURCES_H_ |
OLD | NEW |