Add support for $i18n{} for component app/extension resources.
i18n-values and i18n-content are deprecated, to be replaced by $i18n{}
in Web UI. Allow component apps/extensions to use the same i18n template
replacements as Web UI during serving.
Update the Files app quickview localization covered by a test to use
this method.
Bug: 923206,923204
Change-Id: I647bdea906c6bc427a82981fac780cc0e6badf2c
Reviewed-on: https://chromium-review.googlesource.com/c/1424619
Commit-Queue: Sam McNally <[email protected]>
Reviewed-by: Noel Gordon <[email protected]>
Reviewed-by: Ken Rockot <[email protected]>
Reviewed-by: Luciano Pacheco <[email protected]>
Cr-Commit-Position: refs/heads/master@{#625122}
diff --git a/extensions/browser/component_extension_resource_manager.h b/extensions/browser/component_extension_resource_manager.h
index 6495f10..b8a1f55 100644
--- a/extensions/browser/component_extension_resource_manager.h
+++ b/extensions/browser/component_extension_resource_manager.h
@@ -5,6 +5,10 @@
#ifndef EXTENSIONS_BROWSER_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_
#define EXTENSIONS_BROWSER_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_
+#include <string>
+
+#include "ui/base/template_expressions.h"
+
namespace base {
class FilePath;
}
@@ -25,6 +29,12 @@
const base::FilePath& extension_path,
const base::FilePath& resource_path,
int* resource_id) const = 0;
+
+ // Returns the i18n template replacements for a component extension if they
+ // exist, or nullptr otherwise. If non-null, the returned value must remain
+ // valid for the life of this ComponentExtensionResourceManager.
+ virtual const ui::TemplateReplacements* GetTemplateReplacementsForExtension(
+ const std::string& extension_id) const = 0;
};
} // namespace extensions