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/callback.h" |
| 11 #include "base/strings/string16.h" |
| 12 #include "media/base/media_export.h" |
| 13 |
| 14 namespace media { |
| 15 |
| 16 // The media layer can't access Chrome's resource bundle directly. This facility |
| 17 // allows clients to provide indirect access. |
| 18 |
| 19 // IDs that will get mapped to corresponding entries with IDS_ prefixes in |
| 20 // chrome/app/generated_resources.grd. |
| 21 enum MessageId { |
| 22 DEFAULT_AUDIO_DEVICE_NAME, |
| 23 #if defined(OS_WIN) |
| 24 COMMUNICATIONS_AUDIO_DEVICE_NAME, |
| 25 #endif |
| 26 #if defined(OS_CHROMEOS) |
| 27 BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 28 BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 29 #endif |
| 30 }; |
| 31 |
| 32 // Implementations are expected to convert MessageIds to generated_resources.grd |
| 33 // IDs and extract the matching string from Chrome's resource bundle (e.g. |
| 34 // through l10n_util::GetStringUTF16). |
| 35 using LocalizedStringProvider = |
| 36 base::Callback<base::string16(MessageId message_id)>; |
| 37 |
| 38 // Initializes the global LocalizedStringProvider callback. Must only be called |
| 39 // once. |
| 40 MEDIA_EXPORT void SetLocalizedStringProvider( |
| 41 const LocalizedStringProvider& callback); |
| 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 |
| 49 } // namespace media |
| 50 |
| 51 #endif // MEDIA_BASE_MEDIA_RESOURCES_H_ |
OLD | NEW |