Chromium Code Reviews| 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); | |
|
DaleCurtis
2015/09/17 16:37:41
Why not using a base::Callback? We don't typically
ajm
2015/09/17 16:52:02
The only reason was to follow net_module's example
| |
| 35 | |
| 36 // Initializes the global LocalizedStringProvider function. | |
| 37 MEDIA_EXPORT void SetLocalizedStringProvider(LocalizedStringProvider func); | |
| 38 | |
| 39 // Returns a resource string corresponding to |message_id|. See l10n_util.h. | |
| 40 // Returns an empty string if the LocalizedStringProvider has not been | |
| 41 // initialized or if the ID is unrecognized. | |
| 42 std::string GetLocalizedStringUTF8(MessageId message_id); | |
| 43 base::string16 GetLocalizedStringUTF16(MessageId message_id); | |
| 44 | |
| 45 } // namespace media | |
| 46 | |
| 47 #endif // MEDIA_BASE_MEDIA_RESOURCES_H_ | |
| OLD | NEW |