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