summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/extensions/extension_resource.cc17
-rw-r--r--chrome/common/extensions/extension_resource_unittest.cc9
2 files changed, 6 insertions, 20 deletions
diff --git a/chrome/common/extensions/extension_resource.cc b/chrome/common/extensions/extension_resource.cc
index 6c1cff6..aeb6231 100644
--- a/chrome/common/extensions/extension_resource.cc
+++ b/chrome/common/extensions/extension_resource.cc
@@ -34,30 +34,15 @@ const FilePath& ExtensionResource::GetFilePath() const {
return full_resource_path_;
}
-// Static version...
+// static
FilePath ExtensionResource::GetFilePath(const FilePath& extension_root,
const FilePath& relative_path) {
- std::vector<FilePath> l10n_relative_paths;
- extension_l10n_util::GetL10nRelativePaths(relative_path,
- &l10n_relative_paths);
-
// We need to resolve the parent references in the extension_root
// path on its own because IsParent doesn't like parent references.
FilePath clean_extension_root(extension_root);
if (!file_util::AbsolutePath(&clean_extension_root))
return FilePath();
- // Stat l10n file(s), and return new path if it exists.
- for (size_t i = 0; i < l10n_relative_paths.size(); ++i) {
- FilePath full_path = clean_extension_root.Append(l10n_relative_paths[i]);
- if (file_util::AbsolutePath(&full_path) &&
- clean_extension_root.IsParent(full_path) &&
- file_util::PathExists(full_path)) {
- return full_path;
- }
- }
-
- // Fall back to root resource.
FilePath full_path = clean_extension_root.Append(relative_path);
// We must resolve the absolute path of the combined path when
diff --git a/chrome/common/extensions/extension_resource_unittest.cc b/chrome/common/extensions/extension_resource_unittest.cc
index 807452e..7493107 100644
--- a/chrome/common/extensions/extension_resource_unittest.cc
+++ b/chrome/common/extensions/extension_resource_unittest.cc
@@ -49,8 +49,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) {
const char* filename = "res.ico";
FilePath root_resource = temp.path().AppendASCII(filename);
std::string data = "some foo";
- ASSERT_TRUE(file_util::WriteFile(root_resource.AppendASCII(filename),
- data.c_str(), data.length()));
+ ASSERT_TRUE(file_util::WriteFile(root_resource, data.c_str(), data.length()));
// Create l10n resources (for current locale and its parents).
FilePath l10n_path = temp.path().AppendASCII(Extension::kLocaleFolder);
@@ -59,6 +58,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) {
std::vector<std::string> locales;
extension_l10n_util::GetParentLocales(l10n_util::GetApplicationLocale(L""),
&locales);
+ ASSERT_FALSE(locales.empty());
for (size_t i = 0; i < locales.size(); i++) {
FilePath make_path;
make_path = l10n_path.AppendASCII(locales[i]);
@@ -71,9 +71,10 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) {
ExtensionResource resource(temp.path(), FilePath().AppendASCII(filename));
FilePath resolved_path = resource.GetFilePath();
- ASSERT_FALSE(locales.empty());
FilePath expected_path;
- expected_path = l10n_path.AppendASCII(locales[0]).AppendASCII(filename);
+ // Expect default path only, since fallback logic is disabled.
+ // See http://crbug.com/27359.
+ expected_path = root_resource;
ASSERT_TRUE(file_util::AbsolutePath(&expected_path));
EXPECT_EQ(ToLower(expected_path.value()), ToLower(resolved_path.value()));