#ifndef CHROMECAST_COMMON_CAST_RESOURCE_DELEGATE_H_
#define CHROMECAST_COMMON_CAST_RESOURCE_DELEGATE_H_
#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include "base/memory/ref_counted_memory.h"
#include "ui/base/resource/resource_bundle.h"
namespace base {
class FilePath;
}
namespace gfx {
class Image;
}
namespace chromecast {
class CastResourceDelegate : public ui::ResourceBundle::Delegate {
public:
static CastResourceDelegate* GetInstance();
CastResourceDelegate();
CastResourceDelegate(const CastResourceDelegate&) = delete;
CastResourceDelegate& operator=(const CastResourceDelegate&) = delete;
~CastResourceDelegate() override;
base::FilePath GetPathForResourcePack(
const base::FilePath& pack_path,
ui::ResourceScaleFactor scale_factor) override;
gfx::Image GetImageNamed(int resource_id) override;
gfx::Image GetNativeImageNamed(int resource_id) override;
bool HasDataResource(int resource_id) const override;
base::RefCountedStaticMemory* LoadDataResourceBytes(
int resource_id,
ui::ResourceScaleFactor scale_factor) override;
std::optional<std::string> LoadDataResourceString(int resource_id) override;
bool GetRawDataResource(int resource_id,
ui::ResourceScaleFactor scale_factor,
std::string_view* value) const override;
bool GetLocalizedString(int message_id, std::u16string* value) const override;
void AddExtraLocalizedString(int resource_id,
const std::u16string& localized);
void RemoveExtraLocalizedString(int resource_id);
void ClearAllExtraLocalizedStrings();
private:
using ExtraLocaledStringMap = std::unordered_map<int, std::u16string>;
ExtraLocaledStringMap extra_localized_strings_;
};
}
#endif