1 // Copyright 2019 The Chromium Embedded Framework Authors. 2 // Portions copyright 2014 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #ifndef CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_ 7 #define CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_ 8 #pragma once 9 10 #include "ui/base/resource/resource_bundle.h" 11 12 class AlloyContentClient; 13 14 class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate { 15 public: CefResourceBundleDelegate()16 CefResourceBundleDelegate() {} 17 set_pack_loading_disabled(bool val)18 void set_pack_loading_disabled(bool val) { pack_loading_disabled_ = val; } pack_loading_disabled()19 bool pack_loading_disabled() const { return pack_loading_disabled_; } set_allow_pack_file_load(bool val)20 void set_allow_pack_file_load(bool val) { allow_pack_file_load_ = val; } allow_pack_file_load()21 bool allow_pack_file_load() const { return allow_pack_file_load_; } 22 23 private: 24 // ui::ResourceBundle::Delegate methods. 25 base::FilePath GetPathForResourcePack( 26 const base::FilePath& pack_path, 27 ui::ResourceScaleFactor scale_factor) override; 28 base::FilePath GetPathForLocalePack(const base::FilePath& pack_path, 29 const std::string& locale) override; 30 gfx::Image GetImageNamed(int resource_id) override; 31 gfx::Image GetNativeImageNamed(int resource_id) override; 32 base::RefCountedStaticMemory* LoadDataResourceBytes( 33 int resource_id, 34 ui::ResourceScaleFactor scale_factor) override; 35 absl::optional<std::string> LoadDataResourceString(int resource_id) override; 36 bool GetRawDataResource(int resource_id, 37 ui::ResourceScaleFactor scale_factor, 38 base::StringPiece* value) const override; 39 bool GetLocalizedString(int message_id, std::u16string* value) const override; 40 41 private: 42 bool pack_loading_disabled_ = false; 43 bool allow_pack_file_load_ = false; 44 }; 45 46 #endif // CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_ 47