refacotr: grit::ResourceMap replaced with webui::ResourcePath
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2685601
This commit is contained in:
parent
dc36e8e6fc
commit
59669e99cb
2 changed files with 6 additions and 5 deletions
|
@ -82,7 +82,7 @@ ElectronComponentExtensionResourceManager::GetTemplateReplacementsForExtension(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
|
void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||||
const GritResourceMap* entries,
|
const webui::ResourcePath* entries,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
base::FilePath gen_folder_path = base::FilePath().AppendASCII(
|
base::FilePath gen_folder_path = base::FilePath().AppendASCII(
|
||||||
"@out_folder@/gen/chrome/browser/resources/");
|
"@out_folder@/gen/chrome/browser/resources/");
|
||||||
|
@ -90,12 +90,12 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||||
|
|
||||||
for (size_t i = 0; i < size; ++i) {
|
for (size_t i = 0; i < size; ++i) {
|
||||||
base::FilePath resource_path =
|
base::FilePath resource_path =
|
||||||
base::FilePath().AppendASCII(entries[i].name);
|
base::FilePath().AppendASCII(entries[i].path);
|
||||||
resource_path = resource_path.NormalizePathSeparators();
|
resource_path = resource_path.NormalizePathSeparators();
|
||||||
|
|
||||||
if (!gen_folder_path.IsParent(resource_path)) {
|
if (!gen_folder_path.IsParent(resource_path)) {
|
||||||
DCHECK(!base::Contains(path_to_resource_id_, resource_path));
|
DCHECK(!base::Contains(path_to_resource_id_, resource_path));
|
||||||
path_to_resource_id_[resource_path] = entries[i].value;
|
path_to_resource_id_[resource_path] = entries[i].id;
|
||||||
} else {
|
} else {
|
||||||
// If the resource is a generated file, strip the generated folder's path,
|
// If the resource is a generated file, strip the generated folder's path,
|
||||||
// so that it can be served from a normal URL (as if it were not
|
// so that it can be served from a normal URL (as if it were not
|
||||||
|
@ -104,7 +104,7 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||||
base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr(
|
base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr(
|
||||||
gen_folder_path.value().length()));
|
gen_folder_path.value().length()));
|
||||||
DCHECK(!base::Contains(path_to_resource_id_, effective_path));
|
DCHECK(!base::Contains(path_to_resource_id_, effective_path));
|
||||||
path_to_resource_id_[effective_path] = entries[i].value;
|
path_to_resource_id_[effective_path] = entries[i].id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "extensions/browser/component_extension_resource_manager.h"
|
#include "extensions/browser/component_extension_resource_manager.h"
|
||||||
|
#include "ui/base/webui/resource_path.h"
|
||||||
|
|
||||||
struct GritResourceMap;
|
struct GritResourceMap;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ class ElectronComponentExtensionResourceManager
|
||||||
const std::string& extension_id) const override;
|
const std::string& extension_id) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void AddComponentResourceEntries(const GritResourceMap* entries, size_t size);
|
void AddComponentResourceEntries(const webui::ResourcePath* entries, size_t size);
|
||||||
|
|
||||||
// A map from a resource path to the resource ID. Used by
|
// A map from a resource path to the resource ID. Used by
|
||||||
// IsComponentExtensionResource.
|
// IsComponentExtensionResource.
|
||||||
|
|
Loading…
Reference in a new issue