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