summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorcira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 21:51:51 +0000
committercira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 21:51:51 +0000
commit14e101c0ac5dbf5863ffa0cb38609353eae6d089 (patch)
tree3ec3f5e33f6e356378a8a0a5185f0f5155d3ed5c /chrome/common
parent5db4f3daccd90723fedb244945b90600f332154e (diff)
downloadchromium_src-14e101c0ac5dbf5863ffa0cb38609353eae6d089.zip
chromium_src-14e101c0ac5dbf5863ffa0cb38609353eae6d089.tar.gz
chromium_src-14e101c0ac5dbf5863ffa0cb38609353eae6d089.tar.bz2
Temporarily disable resource fallback for ExtensionResource::GetFilePath. We need to figure out how to make it faster.
We'll use chrome.extension.getURL(chrome.i18n.getMessage("resource")) for now to implement fallback. BUG=27359 Review URL: http://codereview.chromium.org/385045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31720 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-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()));