2015-07-16 23:40:01 +02:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_EXTENSIONS_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include "base/files/file_path.h"
|
|
|
|
#include "extensions/browser/component_extension_resource_manager.h"
|
2024-02-22 19:36:15 +01:00
|
|
|
#include "extensions/common/extension_id.h"
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2021-03-04 23:36:57 +01:00
|
|
|
namespace webui {
|
|
|
|
struct ResourcePath;
|
|
|
|
}
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
|
|
|
|
class CefComponentExtensionResourceManager
|
|
|
|
: public ComponentExtensionResourceManager {
|
|
|
|
public:
|
|
|
|
CefComponentExtensionResourceManager();
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefComponentExtensionResourceManager(
|
|
|
|
const CefComponentExtensionResourceManager&) = delete;
|
|
|
|
CefComponentExtensionResourceManager& operator=(
|
|
|
|
const CefComponentExtensionResourceManager&) = delete;
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
~CefComponentExtensionResourceManager() override;
|
|
|
|
|
|
|
|
// Overridden from ComponentExtensionResourceManager:
|
2019-07-16 19:59:21 +02:00
|
|
|
bool IsComponentExtensionResource(const base::FilePath& extension_path,
|
|
|
|
const base::FilePath& resource_path,
|
|
|
|
int* resource_id) const override;
|
2019-02-01 20:40:18 +01:00
|
|
|
const ui::TemplateReplacements* GetTemplateReplacementsForExtension(
|
2024-02-22 19:36:15 +01:00
|
|
|
const ExtensionId& extension_id) const override;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
private:
|
2021-03-04 23:36:57 +01:00
|
|
|
void AddComponentResourceEntries(const webui::ResourcePath* entries,
|
|
|
|
size_t size);
|
2015-07-16 23:40:01 +02:00
|
|
|
|
|
|
|
// A map from a resource path to the resource ID. Used by
|
|
|
|
// IsComponentExtensionResource.
|
2019-07-16 19:59:21 +02:00
|
|
|
std::map<base::FilePath, int> path_to_resource_info_;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2021-01-28 00:13:12 +01:00
|
|
|
// A map from an extension ID to its i18n template replacements.
|
|
|
|
using TemplateReplacementMap =
|
2024-02-22 19:36:15 +01:00
|
|
|
std::map<ExtensionId, ui::TemplateReplacements>;
|
2021-01-28 00:13:12 +01:00
|
|
|
TemplateReplacementMap template_replacements_;
|
2015-07-16 23:40:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace extensions
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_
|