Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_MEDIA_RESOURCES_H_ | 5 #ifndef MEDIA_BASE_MEDIA_RESOURCES_H_ |
| 6 #define MEDIA_BASE_MEDIA_RESOURCES_H_ | 6 #define MEDIA_BASE_MEDIA_RESOURCES_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 13 | 13 |
| 14 namespace media { | 14 namespace media { |
| 15 | 15 |
| 16 // The media layer can't access Chrome's resource bundle directly. This facility | 16 // The media layer can't access Chrome's resource bundle directly. This facility |
| 17 // allows clients to provide indirect access. | 17 // allows clients to provide indirect access. |
| 18 | 18 |
| 19 // IDs that will get mapped to corresponding entries with IDS_ prefixes in | 19 // IDs that will get mapped to corresponding entries with IDS_ prefixes in |
| 20 // chrome/app/generated_resources.grd. | 20 // chrome/app/generated_resources.grd. |
| 21 enum MessageId { | 21 enum MessageId { |
| 22 DEFAULT_AUDIO_DEVICE_NAME, | 22 DEFAULT_AUDIO_DEVICE_NAME, |
| 23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 24 COMMUNICATIONS_AUDIO_DEVICE_NAME, | 24 COMMUNICATIONS_AUDIO_DEVICE_NAME, |
| 25 #endif | 25 #endif |
| 26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 27 BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME, | 27 BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 28 BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME, | 28 BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME, |
| 29 #endif | 29 #endif |
| 30 MEDIA_REMOTING_CAST_ERROR_TEXT, | |
|
xjz
2016/11/03 23:53:39
ditto: add build flag here.
apacible
2016/11/04 01:25:38
Done.
| |
| 31 MEDIA_REMOTING_CASTING_VIDEO_TEXT, | |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 // Implementations are expected to convert MessageIds to generated_resources.grd | 34 // Implementations are expected to convert MessageIds to generated_resources.grd |
| 33 // IDs and extract the matching string from Chrome's resource bundle (e.g. | 35 // IDs and extract the matching string from Chrome's resource bundle (e.g. |
| 34 // through l10n_util::GetStringUTF16). | 36 // through l10n_util::GetStringUTF16). |
| 35 using LocalizedStringProvider = base::string16 (*)(MessageId message_id); | 37 using LocalizedStringProvider = base::string16 (*)(MessageId message_id); |
| 36 | 38 |
| 37 // Initializes the global LocalizedStringProvider function. | 39 // Initializes the global LocalizedStringProvider function. |
| 38 MEDIA_EXPORT void SetLocalizedStringProvider(LocalizedStringProvider func); | 40 MEDIA_EXPORT void SetLocalizedStringProvider(LocalizedStringProvider func); |
|
xjz
2016/11/03 23:53:39
Do we need MEDIA_EXPORT here?
apacible
2016/11/04 01:25:38
Yes.
xjz
2016/11/04 22:10:23
I think only component needs export. right? Also,
apacible
2016/11/05 01:12:51
Ack.
| |
| 39 | 41 |
| 40 #if !defined(OS_IOS) | 42 #if !defined(OS_IOS) |
| 41 // The LocalizedStringProvider has probably not been initialized on iOS. This | 43 // The LocalizedStringProvider has probably not been initialized on iOS. This |
| 42 // will give an early compile warning for clients attempting to use it. | 44 // will give an early compile warning for clients attempting to use it. |
| 43 | 45 |
| 44 // Returns a resource string corresponding to |message_id|. See l10n_util.h. | 46 // Returns a resource string corresponding to |message_id|. See l10n_util.h. |
| 45 // Returns an empty string if the LocalizedStringProvider has not been | 47 // Returns an empty string if the LocalizedStringProvider has not been |
| 46 // initialized or if the ID is unrecognized. | 48 // initialized or if the ID is unrecognized. |
| 47 std::string GetLocalizedStringUTF8(MessageId message_id); | 49 MEDIA_EXPORT std::string GetLocalizedStringUTF8(MessageId message_id); |
|
xjz
2016/11/03 23:53:39
ditto: MEDIA_EXPORT
apacible
2016/11/04 01:25:38
Yes, we need MEDIA_EXPORT to use the function.
xjz
2016/11/04 22:10:23
ditto.
apacible
2016/11/05 01:12:51
Removed MEDIA_EXPORT.
| |
| 48 base::string16 GetLocalizedStringUTF16(MessageId message_id); | 50 base::string16 GetLocalizedStringUTF16(MessageId message_id); |
| 49 #endif | 51 #endif |
| 50 | 52 |
| 51 } // namespace media | 53 } // namespace media |
| 52 | 54 |
| 53 #endif // MEDIA_BASE_MEDIA_RESOURCES_H_ | 55 #endif // MEDIA_BASE_MEDIA_RESOURCES_H_ |
| OLD | NEW |